Skip to content

Commit

Permalink
fix(browser): re-add non-spec timeout option
Browse files Browse the repository at this point in the history
  • Loading branch information
larsgw committed May 26, 2022
1 parent a7d7def commit 168a46c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ function syncFetch (...args) {

const xhr = new XMLHttpRequest()
xhr.withCredentials = request.credentials === 'include'
xhr.timeout = request[INTERNALS].timeout

// Request
xhr.open(request.method, request.url, false)
Expand Down Expand Up @@ -102,7 +103,10 @@ class SyncRequest {
method: init.method || 'GET',
headers: new syncFetch.Headers(init.headers),
body: init.body ? Buffer.from(init.body) : null,
credentials: init.credentials || 'omit'
credentials: init.credentials || 'omit',

// Non-spec
timeout: init.timeout || 0
}

if (typeof resource === 'string') {
Expand Down

0 comments on commit 168a46c

Please sign in to comment.