-
Notifications
You must be signed in to change notification settings - Fork 120
Open
Labels
Description
Hello all 👋
I'm currently trying out apollo-link-rest via a node script, and ran into issues with how it expects to use Headers class off of the global object. I'm currently using the cross-fetch package to pull in a fetch ponyfill and passing it into the RestLink constructor via the customFetch option. However there doesn't seem to be a way to do that with the Headers object as well. I'm currently just fully polyfilling the Headers class on the global object, but would like to be able to pass it in via the constructor on a customHeaders option instead.
Proposal:
const { fetch, Headers} = require("cross-fetch");
const { RestLink } = require("apollo-link-rest");
const restLink = new RestLink({
... // other options
customFetch: fetch,
customHeaders: Headers,
});
Workaround:
const { fetch, Headers} = require("cross-fetch");
const { RestLink } = require("apollo-link-rest");
global.Headers = Headers;
const restLink = new RestLink({
... // other options
customFetch: fetch,
});
For the sake of easily replicating this, I've added a repository that reproduces this: https://github.com/basicdays/ghtest
Reactions are currently unavailable