Replies: 3 comments 3 replies
-
|
I'm in the same boat. Maybe this is a spring boot configuration? |
Beta Was this translation helpful? Give feedback.
-
|
@karhig, @eblanchette - We will add better documentation with examples for this. In short, the build() method gives you access to a new instance of the context. You can then add whatever setters you need to the custom context implementation to pass down the required context to child fetchers. Note that this context should have the scope of the request (not local context specific to data fetchers, you can use the local context in dfe for that). Where MyCustomContext is your implementation Hope that helps. |
Beta Was this translation helpful? Give feedback.
-
|
We have implemented some new features since this thread. DgsCustomContextBuilderWithRequest interface DgsCustomContextBuilderWithRequest<T> {
fun build(extensions: Map<String, Any>?, headers: HttpHeaders?, webRequest: WebRequest?): T
}Similar to the original The existing interface still exists for backward compatibility. @RequestHeader @DgsData(parentType = "Query", field = "usingHeader")
fun usingRequestHeader(@RequestHeader myheader: String?): String |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I thought
DgsCustomContextBuilderwould be the place to extract information from the headers, such as decoding a jwt to make it available to requests. The default context provides access to headers, but becaue thebuild()method ofDgsCustomContextBuilderis parameterless, I don't understand how to do this, or how to make use of it in general. The documentation isn't very illuminating.Could someone help me out?
Beta Was this translation helpful? Give feedback.
All reactions