Reputation: 13
I'm using Quarkus GraphQL in my project. Defined a class with @GraphQLApi and a @Query method inside it. I'm not sure how to access the HttpHeaders in the defined method when querying a request. I tried @HeaderParam but I'm getting a null value. There isn't much about the headers in the quarkus documentation either. Is there a way to get the headers from the @Query methods?.
Upvotes: 1
Views: 1649
Reputation: 1314
The GraphQL API itself does not currently offer access to HTTP headers, but you can inject an instance of CurrentVertxRequest
and read the headers from there:
@Inject
CurrentVertxRequest request;
// and in your query method:
request.getCurrent().request().getHeader("My-Header")
Upvotes: 4