graphql-tools
graphql-tools copied to clipboard
Adding content-type header is not supported when fetching schema
trafficstars
Issue workflow progress
Progress of the issue based on the Contributor Workflow
- [x] 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox
Make sure to fork this template and run
yarn generatein the terminal.Please make sure the GraphQL Tools package versions under
package.jsonmatches yours. - [x] 2. A failing test has been provided
- [x] 3. A local solution has been provided
- [x] 4. A pull request is pending review
Describe the bug
To Reproduce Steps to reproduce the behavior:
- Run graphql-codegen on a schema like the following:
schema:
- https://my.schema/graphql:
headers:
content-type: 'application/vnd.api+json'
extensions:
codegen:
generates:
'schema.graphql':
plugins:
- schema-ast
- Observe that the request for introspection is made with header
content-type: application/json, i.e. your config is not obeyed
Expected behavior
- The request for introspection is made with the header
content-type: application/vnd.api+json
Environment:
- OS:
@graphql-tools/executor-http: 1.0.6- NodeJS:
Additional context
The bug is caused by this line: https://github.com/ardatan/graphql-tools/blob/master/packages/executors/http/src/index.ts#L204