Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions lib/web/fetch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2055,7 +2055,7 @@ async function httpNetworkFetch (

function dispatch ({ body }) {
const url = requestCurrentURL(request)
/** @type {import('../..').Agent} */
/** @type {import('../../..').Agent} */
const agent = fetchParams.controller.dispatcher

return new Promise((resolve, reject) => agent.dispatch(
Expand Down Expand Up @@ -2104,12 +2104,11 @@ async function httpNetworkFetch (

onHeaders (status, rawHeaders, resume, statusText) {
if (status < 200) {
return
return false
}

/** @type {string[]} */
let codings = []
let location = ''

const headersList = new HeadersList()

Expand All @@ -2122,7 +2121,7 @@ async function httpNetworkFetch (
// "All content-coding values are case-insensitive..."
codings = contentEncoding.toLowerCase().split(',').map((x) => x.trim())
}
location = headersList.get('location', true)
const location = headersList.get('location', true)

this.body = new Readable({ read: resume })

Expand Down
7 changes: 7 additions & 0 deletions lib/web/fetch/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -1327,10 +1327,17 @@ function urlIsHttpHttpsScheme (url) {
return protocol === 'http:' || protocol === 'https:'
}

/**
* @typedef {Object} RangeHeaderValue
* @property {number|null} rangeStartValue
* @property {number|null} rangeEndValue
*/

/**
* @see https://fetch.spec.whatwg.org/#simple-range-header-value
* @param {string} value
* @param {boolean} allowWhitespace
* @return {RangeHeaderValue|'failure'}
*/
function simpleRangeHeaderValue (value, allowWhitespace) {
// 1. Let data be the isomorphic decoding of value.
Expand Down
Loading