Skip to content

Commit

Permalink
Change the way I checked for Headers
Browse files Browse the repository at this point in the history
Apparent `windows` is undefined in Node v12.11.1.
Checked the Headers object directly instead.  Less complications involved.

Fix #5
  • Loading branch information
zellwk committed Oct 3, 2019
1 parent 82155f2 commit d9063c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/createRequestOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ const setHeaders = ({
method = 'get',
auth
} = {}) => {
if (!window.Headers) require('isomorphic-fetch')
if (typeof Headers === 'undefined') {
require('isomorphic-fetch')
}

const h = new Headers(headers)

// Sets content type to 'application/json' for POST, PUT, PATCH, DELETE requests
Expand Down
1 change: 0 additions & 1 deletion test/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* globals beforeEach afterEach describe expect it */
require('isomorphic-fetch')
const portastic = require('portastic')
const zlFetch = require('../src/index')
const app = require('./helpers/createServer')
Expand Down

0 comments on commit d9063c6

Please sign in to comment.