graphql / graphql/graphiql

Request headers are cleaned

Open
#1,596 12 comments 0 reactions 0 assignees View on GitHub
bug good first issue graphiql
Dominant language
TypeScript
Stars
16.9k
Forks
1.9k
Avg merge
22h 45m
Merged PRs (30d)
70

Description

In the following code, according to the documentation, request headers should be persisted, but they are cleaned after page is refreshed.

```html

function graphQLFetcher(graphQLParams, opts = {headers: {}}) {
return fetch(
'/api',
{
method: 'post',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
...opts.headers
},
body: JSON.stringify(graphQLParams),
credentials: 'omit',
},
).then(function (response) {
return response.json().catch(function () {
return response.text();
});
});
}

ReactDOM.render(
React.createElement(GraphiQL, {
fetcher: graphQLFetcher,
headerEditorEnabled: true,
}),
document.getElementById('graphiql'),
);

```

```headers: an optional GraphQL string to use as the initial displayed request headers, if undefined is provided, the stored headers will be used.```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.