Skip to content
Myr

Fix the empty check for `.json()` (#466)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Runger · committed by GitHub · parent 4f1e7a1 · Browse files · 1 file+3 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−3 removed

  • other:+3 added−3 removed

1 file+3 added−3 removed

modified:source/core/Ky.ts+3 added-3 removed
89 unmodified lines
90 if (response.status === 204) {91 return '';92 }9394 const contentLength = response.headers.get('Content-Length');95 const transferEncoding = response.headers.get('Transfer-Encoding');96 if ((contentLength === null || contentLength === '0') && transferEncoding !== 'chunked') {94 const arrayBuffer = await response.clone().arrayBuffer();95 const responseSize = arrayBuffer.byteLength;96 if (responseSize === 0) {97 return '';98 }99100 if (options.parseJson) {
261 unmodified lines