-
Hi, I'm trying to build spring server with version interface GraphQLContextFactory<out Context : GraphQLContext, Request> {
fun generateContext(request: Request): Context?
} Now @Component
class MyGraphQLContextFactory: GraphQLContextFactory<MyGraphQLContext> {
override suspend fun generateContext(
request: ServerHttpRequest,
response: ServerHttpResponse
): MyGraphQLContext = MyGraphQLContext(
myCustomValue = request.headers.getFirst("MyHeader") ?: "defaultValue"
)
} Can I know workaround to do it? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
The context fetching currently is required before we can execute an operation so we explicitly made it non-suspending when we had setup the new @dariuszkuc This brings up a good point though, should we be allowing the context fetching and/or request parsing to happen asynchronously? That would mean that everyone must use suspend even if their context building is straight forward |
Beta Was this translation helpful? Give feedback.
-
Sorry for moving to fast @LEECHHE, I can not move a discussion back to issues so I opened a new one here: #1052 |
Beta Was this translation helpful? Give feedback.
Sorry for moving to fast @LEECHHE, I can not move a discussion back to issues so I opened a new one here: #1052