npm.io
1.0.0 • Published 8 years ago

graphiql-custom-headers

Licence
SEE LICENSE IN LICENSE
Version
1.0.0
Deps
3
Vulns
5
Weekly
0
Stars
1

GraphiQL - With Custom Headers

Checkout the GraphiQL documentation on https://github.com/graphql/graphiql

To allow Custom Headers feature your graphQLFetcher might take an extra argument and supply it instead of headers:

function graphQLFetcher(graphQLParams, myCustomHeaders) {
  return fetch(window.location.origin + '/graphql', {
    method: 'post',
    headers: myCustomHeaders,
    body: JSON.stringify(graphQLParams),
  }).then(response => response.json());
}

Copyright (c) 2015, Facebook, Inc. All rights reserved.