spring-graphql icon indicating copy to clipboard operation
spring-graphql copied to clipboard

How to provide context to response in WebGraphQlInterceptor?

Open hameno opened this issue 1 year ago • 3 comments

We need to access some contextual data about the executed GraphQL query in a HttpFilter. I tried to make use of Context Propagation using a ThreadLocal but it does not seem to be written to (only read).

What am I missing?

Example:

WebGraphQlInterceptor { request, chain ->
        chain.next(request).flatMap { response -> 
            Mono.just(response).contextWrite(Context.of("TEST", "value from response"))
        }
    }

hameno avatar Oct 04 '24 11:10 hameno