nestjs
nestjs copied to clipboard
graphql-request - headers not passed correctly to the request method
my setup module:
GraphQLRequestModule.forRoot(GraphQLRequestModule, {
endpoint: 'http://localhost:3165/graphql',
options: {
headers: {
'content-type': 'application/json',
},
},
}),
service:
constructor(
@InjectGraphQLClient() private readonly client: GraphQLClient,
) { }
method:
async getData() {
...
const headers: Dom.RequestInit['headers'] = {var: 1}
const res = await this.client.request(data, {}, headers);
...
}
but the request headers don't contain var
I try tp follow the type value:
request<T = any, V = Variables>(document: RequestDocument, variables?: V, requestHeaders?: Dom.RequestInit['headers']): Promise<T>;
but can't make it work.
Did I make some mistake??
I also encountered this problem. It happens because the module uses an outdated version of "graphql-request": "^1.8.2", which only supports global headers.
@leanpilar @PainteR fixed in @golevelup/[email protected]
Getting this error again in @golevelup/[email protected]