Skip to content

Commit

Permalink
Support Ky usage in web workers (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
loilo authored and sindresorhus committed Sep 29, 2018
1 parent 66fb6c3 commit 1e542eb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions index.js
Expand Up @@ -110,7 +110,7 @@ class Ky {
this._hooks = hooks;
this._throwHttpErrors = throwHttpErrors;

const headers = new window.Headers(this._options.headers || {});
const headers = new self.Headers(this._options.headers || {});

if (json) {
headers.set('content-type', 'application/json');
Expand Down Expand Up @@ -173,7 +173,7 @@ class Ky {
await hook(this._options);
}

return timeout(window.fetch(this._input, this._options), this._timeout);
return timeout(self.fetch(this._input, this._options), this._timeout);
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/_require.js
@@ -1,7 +1,7 @@
import {URL} from 'url';
import fetch, {Headers} from 'node-fetch';

global.window = {
global.self = {
fetch,
Headers
};
Expand Down

0 comments on commit 1e542eb

Please sign in to comment.