{"action":"closed","issue":{"url":"https://api.github.com/repos/apollostack/apollo-client/issues/920","repository_url":"https://api.github.com/repos/apollostack/apollo-client","labels_url":"https://api.github.com/repos/apollostack/apollo-client/issues/920/labels{/name}","comments_url":"https://api.github.com/repos/apollostack/apollo-client/issues/920/comments","events_url":"https://api.github.com/repos/apollostack/apollo-client/issues/920/events","html_url":"https://github.com/apollostack/apollo-client/issues/920","id":189651495,"number":920,"title":"cannot override request header with batchedNetworkInterface","user":{"login":"cupools","id":5516312,"avatar_url":"https://avatars.githubusercontent.com/u/5516312?v=3","gravatar_id":"","url":"https://api.github.com/users/cupools","html_url":"https://github.com/cupools","followers_url":"https://api.github.com/users/cupools/followers","following_url":"https://api.github.com/users/cupools/following{/other_user}","gists_url":"https://api.github.com/users/cupools/gists{/gist_id}","starred_url":"https://api.github.com/users/cupools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cupools/subscriptions","organizations_url":"https://api.github.com/users/cupools/orgs","repos_url":"https://api.github.com/users/cupools/repos","events_url":"https://api.github.com/users/cupools/events{/privacy}","received_events_url":"https://api.github.com/users/cupools/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-11-16T10:00:04Z","updated_at":"2016-11-17T11:15:55Z","closed_at":"2016-11-17T11:15:55Z","body":"Hi all,\r\nI found the follow code in [batchedNetworkInterface.ts](https://github.com/apollostack/apollo-client/blob/master/src/transport/batchedNetworkInterface.ts#L120-L127) which overrides the given `opts`, and thus I can't set my custom header. But it is possible with [networkInterface](https://github.com/apollostack/apollo-client/blob/master/src/transport/networkInterface.ts#L162-L170).\r\n\r\nSo any ideas about why `batchedNetworkInterface` overrides the given header `Accept` and `Content-Type`, or how can I deal with the question.\r\n\r\n```ts\r\n// networkInterface.ts\r\n// ...\r\nconst printedRequests = requestsAndOptions.map(({ request }) => {\r\n  return printRequest(request);\r\n});\r\n\r\nreturn fetch(this._uri, assign({}, this._opts, options, {\r\n  body: JSON.stringify(printedRequests),\r\n  headers: assign({}, options.headers, {\r\n    Accept: '*/*',\r\n    'Content-Type': 'application/json',\r\n  }),\r\n  method: 'POST',\r\n}));\r\n// ...\r\n```\r\n\r\n```js\r\n// my custom header not work\r\nconst batchingNetworkInterface = createBatchingNetworkInterface({\r\n  uri: '/graphql',\r\n  batchInterval: 10,\r\n  opts: {\r\n    method: 'POST',\r\n    headers: {\r\n      'Accept': 'application/json, text/plain, */*',\r\n      'Content-Type': 'x-www-form-urlencoded'\r\n    },\r\n    body: JSON.stringify({ foo: 1 })\r\n  }\r\n})\r\nconst apolloClient = new ApolloClient({\r\n  networkInterface: batchingNetworkInterface\r\n})\r\n```\r\n"}}
{"actor":{"display_login":"helfer"}}