Skip to content

Commit

Permalink
fix: remove keepalive fetch option
Browse files Browse the repository at this point in the history
Only seems relevant for browser.

Refs: https://javascript.info/fetch-api#keepalive
  • Loading branch information
ronag committed Aug 3, 2021
1 parent 5ff1b7e commit 82b1371
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ https://fetch.spec.whatwg.org/#request-class
* **cache** *not supported*
* **redirect** `RequestRedirect` *only `"follow"` supported*
* **integrity** *not supported*
* **keepalive** `boolean`
* **keepalive** *not supported*
* **signal** `AbortSignal?`
* **window** `null`

Expand Down
8 changes: 2 additions & 6 deletions lib/api/api-fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ function fetch (opts, callback) {
headers.set('accept-language', '*')
}

const [body, contentType] = extractBody(opts.body, opts.keepalive)
const [body, contentType] = extractBody(opts.body)

if (contentType) {
// TODO: Should this also check `!headers.has('content-type')`?
Expand Down Expand Up @@ -300,7 +300,7 @@ function normalizeAndValidateRequestMethod (method) {
return normalizedMethod
}

function extractBody (body, keepalive = false) {
function extractBody (body) {
// TODO: FormBody

if (body == null) {
Expand Down Expand Up @@ -331,10 +331,6 @@ function extractBody (body, keepalive = false) {
assert(false, 'disturbed')
}

if (keepalive) {
throw new TypeError('Cannot extract body while keepalive is true')
}

return [body, null]
} else {
throw Error('Cannot extract Body from input: ', body)
Expand Down

0 comments on commit 82b1371

Please sign in to comment.