Skip to content

Commit

Permalink
Fix Headers bug in IE11
Browse files Browse the repository at this point in the history
When calling `new Headers(undefined)` in IE11 an `Invalid argument` exception is thrown.
With this in place, we'll call it with an empty object, resulting in an empty Headers object.
  • Loading branch information
Multiply committed Apr 25, 2019
1 parent d0ba386 commit 78825c6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### vNEXT

- Allow `GraphQLRequestListener` callbacks in plugins to depend on `this`. [PR #2470](https://github.com/apollographql/apollo-server/pull/2470)
- Fix `Invalid argument` in IE11, when using `apollo-datasource-rest` when `this.headers` is `undefined`. [PR #2607](https://github.com/apollographql/apollo-server/pull/2607)

### v2.4.8

Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-datasource-rest/src/RESTDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export abstract class RESTDataSource<TContext = any> extends DataSource {
}

if (!(init.headers && init.headers instanceof Headers)) {
init.headers = new Headers(init.headers);
init.headers = new Headers(init.headers || {});
}

const options = init as RequestOptions;
Expand Down

0 comments on commit 78825c6

Please sign in to comment.