diff --git a/lib/web/fetch/headers.js b/lib/web/fetch/headers.js index 39648ad1d02..44b1f52bb3f 100644 --- a/lib/web/fetch/headers.js +++ b/lib/web/fetch/headers.js @@ -15,14 +15,16 @@ const util = require('node:util') /** * @param {number} code + * @returns {code is (0x0a | 0x0d | 0x09 | 0x20)} */ function isHTTPWhiteSpaceCharCode (code) { - return code === 0x00a || code === 0x00d || code === 0x009 || code === 0x020 + return code === 0x0a || code === 0x0d || code === 0x09 || code === 0x20 } /** * @see https://fetch.spec.whatwg.org/#concept-header-value-normalize * @param {string} potentialValue + * @returns {string} */ function headerValueNormalize (potentialValue) { // To normalize a byte sequence potentialValue, remove @@ -36,6 +38,10 @@ function headerValueNormalize (potentialValue) { return i === 0 && j === potentialValue.length ? potentialValue : potentialValue.substring(i, j) } +/** + * @param {Headers} headers + * @param {Array|Object} object + */ function fill (headers, object) { // To fill a Headers object headers with a given object object, run these steps: @@ -75,6 +81,9 @@ function fill (headers, object) { /** * @see https://fetch.spec.whatwg.org/#concept-headers-append + * @param {Headers} headers + * @param {string} name + * @param {string} value */ function appendHeader (headers, name, value) { // 1. Normalize value. @@ -417,8 +426,15 @@ class HeadersList { // https://fetch.spec.whatwg.org/#headers-class class Headers { #guard + /** + * @type {HeadersList} + */ #headersList + /** + * @param {HeadersInit|Symbol} [init] + * @returns + */ constructor (init = undefined) { if (init === kConstruct) { return @@ -627,8 +643,12 @@ class Headers { return o.#headersList } - static setHeadersList (o, list) { - o.#headersList = list + /** + * @param {Headers} target + * @param {HeadersList} list + */ + static setHeadersList (target, list) { + target.#headersList = list } }