Closed
Description
Affects: spring-webflux 5.3.7
I write my filter, pass some parameters to coroutine context via witchContext
and want to be able use it later in the child coroutines and handlers. The problem is that CoroutineContext
is lost in filter chain.
For example something like this
@Bean
fun testRouter(tracingFilter: ITracingFilter) = coRouter {
GET("/test") { request ->
val span = coroutineContext[SpanContext] // is null
someHandler.processRequest()
}
filter{ serverRequest, suspendFunction ->
withContext(SpanContext()) {
suspendFunction.invoke(serverRequest)
}
}
}