From 19261b1ee3f7c3a49072830e844b500f526a89c0 Mon Sep 17 00:00:00 2001 From: Nathan Baulch Date: Tue, 24 Sep 2024 07:21:28 +1000 Subject: [PATCH 1/3] Fix typos --- GOVERNANCE.md | 2 +- README.md | 4 ++-- docs/docs/api/Debug.md | 2 +- docs/docs/api/Dispatcher.md | 4 ++-- docs/docs/api/MockPool.md | 2 +- docs/docs/api/RetryAgent.md | 2 +- docs/docs/api/RetryHandler.md | 2 +- lib/api/readable.js | 2 +- lib/dispatcher/client-h2.js | 2 +- lib/handler/redirect-handler.js | 2 +- lib/handler/retry-handler.js | 4 ++-- lib/llhttp/constants.js | 4 ++-- lib/web/eventsource/eventsource-stream.js | 2 +- lib/web/fetch/body.js | 10 +++++----- lib/web/fetch/data-url.js | 4 ++-- lib/web/fetch/formdata-parser.js | 2 +- lib/web/fetch/headers.js | 6 +++--- lib/web/fetch/index.js | 6 +++--- lib/web/fetch/response.js | 4 ++-- lib/web/fetch/util.js | 6 +++--- lib/web/fetch/webidl.js | 4 ++-- test/fetch/headers.js | 4 ++-- test/interceptors/retry.js | 4 ++-- test/mock-agent.js | 2 +- test/mock-interceptor-unused-assertions.js | 2 +- test/node-fetch/main.js | 4 ++-- test/node-test/autoselectfamily.js | 2 +- test/node-test/balanced-pool.js | 2 +- test/node-test/tree.js | 2 +- 29 files changed, 49 insertions(+), 49 deletions(-) diff --git a/GOVERNANCE.md b/GOVERNANCE.md index 3e88d4bb139..dc1223cb07f 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -50,7 +50,7 @@ request or issue. The WG should serve as the final arbiter where required. For the current list of Collaborators, see the project -[README.md](./README.md#collaborators). The list shall be in an +[README.md](./README.md#collaborators). The list should be in alphabetical order. ### WG Membership diff --git a/README.md b/README.md index 7d509997e3b..ae2f7c0037b 100644 --- a/README.md +++ b/README.md @@ -230,7 +230,7 @@ A body can be of the following types: - URLSearchParams - FormData -In this implementation of fetch, ```request.body``` now accepts ```Async Iterables```. It is not present in the [Fetch Standard.](https://fetch.spec.whatwg.org) +In this implementation of fetch, ```request.body``` now accepts ```Async Iterables```. It is not present in the [Fetch Standard](https://fetch.spec.whatwg.org). ```js import { fetch } from 'undici' @@ -261,7 +261,7 @@ await fetch('http://example.com', { method: 'POST', body }) - `'half'` -In this implementation of fetch, `request.duplex` must be set if `request.body` is `ReadableStream` or `Async Iterables`, however, even though the value must be set to `'half'`, it is actually a _full_ duplex. For more detail refer to the [Fetch Standard.](https://fetch.spec.whatwg.org/#dom-requestinit-duplex). +In this implementation of fetch, `request.duplex` must be set if `request.body` is `ReadableStream` or `Async Iterables`, however, even though the value must be set to `'half'`, it is actually a _full_ duplex. For more detail refer to the [Fetch Standard](https://fetch.spec.whatwg.org/#dom-requestinit-duplex). #### `response.body` diff --git a/docs/docs/api/Debug.md b/docs/docs/api/Debug.md index 7efc99e3e31..f7a8864b099 100644 --- a/docs/docs/api/Debug.md +++ b/docs/docs/api/Debug.md @@ -2,7 +2,7 @@ Undici (and subsenquently `fetch` and `websocket`) exposes a debug statement that can be enabled by setting `NODE_DEBUG` within the environment. -The flags availabile are: +The flags available are: ## `undici` diff --git a/docs/docs/api/Dispatcher.md b/docs/docs/api/Dispatcher.md index 933f4a730f8..57f8be1e427 100644 --- a/docs/docs/api/Dispatcher.md +++ b/docs/docs/api/Dispatcher.md @@ -478,7 +478,7 @@ The `RequestOptions.method` property should not be value `'CONNECT'`. #### Parameter: `ResponseData` * **statusCode** `number` -* **headers** `Record` - Note that all header keys are lower-cased, e. g. `content-type`. +* **headers** `Record` - Note that all header keys are lower-cased, e.g. `content-type`. * **body** `stream.Readable` which also implements [the body mixin from the Fetch Standard](https://fetch.spec.whatwg.org/#body-mixin). * **trailers** `Record` - This object starts out as empty and will be mutated to contain trailers after `body` has emitted `'end'`. @@ -974,7 +974,7 @@ const client = new Client("http://example.com").compose( }) ); -// or +// or client.dispatch( { path: "/", diff --git a/docs/docs/api/MockPool.md b/docs/docs/api/MockPool.md index 96a986f57bb..18b97d958f6 100644 --- a/docs/docs/api/MockPool.md +++ b/docs/docs/api/MockPool.md @@ -81,7 +81,7 @@ By default, `reply` and `replyWithError` define the behaviour for the first matc ### Return: `MockScope` -A `MockScope` is associated with a single `MockInterceptor`. With this, we can configure the default behaviour of a intercepted reply. +A `MockScope` is associated with a single `MockInterceptor`. With this, we can configure the default behaviour of an intercepted reply. * **delay** `(waitInMs: number) => MockScope` - delay the associated reply by a set amount in ms. * **persist** `() => MockScope` - any matching request will always reply with the defined response indefinitely. diff --git a/docs/docs/api/RetryAgent.md b/docs/docs/api/RetryAgent.md index 53ce5231315..2d9200fd30f 100644 --- a/docs/docs/api/RetryAgent.md +++ b/docs/docs/api/RetryAgent.md @@ -40,6 +40,6 @@ import { Agent, RetryAgent } from 'undici' const agent = new RetryAgent(new Agent()) const res = await agent.request('http://example.com') -console.log(res.statuCode) +console.log(res.statusCode) console.log(await res.body.text()) ``` diff --git a/docs/docs/api/RetryHandler.md b/docs/docs/api/RetryHandler.md index 0dd9f29533f..62baafb676a 100644 --- a/docs/docs/api/RetryHandler.md +++ b/docs/docs/api/RetryHandler.md @@ -46,7 +46,7 @@ It represents the retry state for a given request. - **dispatch** `(options: Dispatch.DispatchOptions, handlers: Dispatch.DispatchHandlers) => Promise` (required) - Dispatch function to be called after every retry. - **handler** Extends [`Dispatch.DispatchHandlers`](Dispatcher.md#dispatcherdispatchoptions-handler) (required) - Handler function to be called after the request is successful or the retries are exhausted. ->__Note__: The `RetryHandler` does not retry over stateful bodies (e.g. streams, AsyncIterable) as those, once consumed, are left in an state that cannot be reutilized. For these situations the `RetryHandler` will identify +>__Note__: The `RetryHandler` does not retry over stateful bodies (e.g. streams, AsyncIterable) as those, once consumed, are left in a state that cannot be reutilized. For these situations the `RetryHandler` will identify >the body as stateful and will not retry the request rejecting with the error `UND_ERR_REQ_RETRY`. Examples: diff --git a/lib/api/readable.js b/lib/api/readable.js index 4e440b213c8..09cf16b0183 100644 --- a/lib/api/readable.js +++ b/lib/api/readable.js @@ -86,7 +86,7 @@ class BodyReadable extends Readable { // Workaround for Node "bug". If the stream is destroyed in same // tick as it is created, then a user who is waiting for a - // promise (i.e micro tick) for installing a 'error' listener will + // promise (i.e micro tick) for installing an 'error' listener will // never get a chance and will always encounter an unhandled exception. if (!this[kUsed]) { setImmediate(() => { diff --git a/lib/dispatcher/client-h2.js b/lib/dispatcher/client-h2.js index 6c5155717d1..d3d4a819313 100644 --- a/lib/dispatcher/client-h2.js +++ b/lib/dispatcher/client-h2.js @@ -281,7 +281,7 @@ function writeH2 (client, request) { } // We do not destroy the socket as we can continue using the session - // the stream get's destroyed and the session remains to create new streams + // the stream gets destroyed and the session remains to create new streams util.destroy(body, err) } diff --git a/lib/handler/redirect-handler.js b/lib/handler/redirect-handler.js index 7db5eaf385e..151cbe2f966 100644 --- a/lib/handler/redirect-handler.js +++ b/lib/handler/redirect-handler.js @@ -146,7 +146,7 @@ class RedirectHandler { TLDR: undici always ignores 3xx response bodies. - Redirection is used to serve the requested resource from another URL, so it is assumes that + Redirection is used to serve the requested resource from another URL, so it assumes that no body is generated (and thus can be ignored). Even though generating a body is not prohibited. For status 301, 302, 303, 307 and 308 (the latter from RFC 7238), the specs mention that the body usually diff --git a/lib/handler/retry-handler.js b/lib/handler/retry-handler.js index b4b50b29541..bf8fc0ae1c4 100644 --- a/lib/handler/retry-handler.js +++ b/lib/handler/retry-handler.js @@ -194,8 +194,8 @@ class RetryHandler { // Only Partial Content 206 supposed to provide Content-Range, // any other status code that partially consumed the payload - // should not be retry because it would result in downstream - // wrongly concatanete multiple responses. + // should not be retried because it would result in downstream + // wrongly concatenate multiple responses. if (statusCode !== 206 && (this.start > 0 || statusCode !== 200)) { this.abort( new RequestRetryError('server does not support the range header and the payload was partially consumed', statusCode, { diff --git a/lib/llhttp/constants.js b/lib/llhttp/constants.js index 3e1dc01cdb5..8e7f2918069 100644 --- a/lib/llhttp/constants.js +++ b/lib/llhttp/constants.js @@ -222,7 +222,7 @@ exports.STATUSES = { WEB_SERVER_IS_DOWN: 521, // Unofficial CONNECTION_TIMEOUT: 522, // Unofficial ORIGIN_IS_UNREACHABLE: 523, // Unofficial - TIMEOUT_OCCURED: 524, // Unofficial + TIMEOUT_OCCURRED: 524, // Unofficial SSL_HANDSHAKE_FAILED: 525, // Unofficial INVALID_SSL_CERTIFICATE: 526, // Unofficial RAILGUN_ERROR: 527, // Unofficial @@ -401,7 +401,7 @@ exports.STATUSES_HTTP = [ exports.STATUSES.WEB_SERVER_IS_DOWN, exports.STATUSES.CONNECTION_TIMEOUT, exports.STATUSES.ORIGIN_IS_UNREACHABLE, - exports.STATUSES.TIMEOUT_OCCURED, + exports.STATUSES.TIMEOUT_OCCURRED, exports.STATUSES.SSL_HANDSHAKE_FAILED, exports.STATUSES.INVALID_SSL_CERTIFICATE, exports.STATUSES.RAILGUN_ERROR, diff --git a/lib/web/eventsource/eventsource-stream.js b/lib/web/eventsource/eventsource-stream.js index 59cf7468800..70cec9c2812 100644 --- a/lib/web/eventsource/eventsource-stream.js +++ b/lib/web/eventsource/eventsource-stream.js @@ -196,7 +196,7 @@ class EventSourceStream extends Transform { // If the previous line ended with an end-of-line, we need to check // if the next character is also an end-of-line. if (this.eventEndCheck) { - // If the the current character is an end-of-line, then the event + // If the current character is an end-of-line, then the event // is finished and we can process it // If the previous line ended with a carriage return, we need to diff --git a/lib/web/fetch/body.js b/lib/web/fetch/body.js index 83426cd586a..f16adfd3828 100644 --- a/lib/web/fetch/body.js +++ b/lib/web/fetch/body.js @@ -90,7 +90,7 @@ function extractBody (object, keepalive = false) { // URLSearchParams // spec says to run application/x-www-form-urlencoded on body.list - // this is implemented in Node.js as apart of an URLSearchParams instance toString method + // this is implemented in Node.js as part of an URLSearchParams instance toString method // See: https://github.com/nodejs/node/blob/e46c680bf2b211bbd52cf959ca17ee98c7f657f5/lib/internal/url.js#L490 // and https://github.com/nodejs/node/blob/e46c680bf2b211bbd52cf959ca17ee98c7f657f5/lib/internal/url.js#L1100 @@ -120,7 +120,7 @@ function extractBody (object, keepalive = false) { // Set action to this step: run the multipart/form-data // encoding algorithm, with object’s entry list and UTF-8. - // - This ensures that the body is immutable and can't be changed afterwords + // - This ensures that the body is immutable and can't be changed afterwards // - That the content-length is calculated in advance. // - And that all parts are pre-encoded and ready to be sent. @@ -215,7 +215,7 @@ function extractBody (object, keepalive = false) { length = Buffer.byteLength(source) } - // 12. If action is non-null, then run these steps in in parallel: + // 12. If action is non-null, then run these steps in parallel: if (action != null) { // Run action. let iterator @@ -262,7 +262,7 @@ function extractBody (object, keepalive = false) { // https://fetch.spec.whatwg.org/#bodyinit-safely-extract function safelyExtractBody (object, keepalive = false) { // To safely extract a body and a `Content-Type` value from - // a byte sequence or BodyInit object object, run these steps: + // a byte sequence or BodyInit object, run these steps: // 1. If object is a ReadableStream object, then: if (object instanceof ReadableStream) { @@ -278,7 +278,7 @@ function safelyExtractBody (object, keepalive = false) { } function cloneBody (instance, body) { - // To clone a body body, run these steps: + // To clone a body, run these steps: // https://fetch.spec.whatwg.org/#concept-body-clone diff --git a/lib/web/fetch/data-url.js b/lib/web/fetch/data-url.js index 2996feca92a..cdc1f82ba7b 100644 --- a/lib/web/fetch/data-url.js +++ b/lib/web/fetch/data-url.js @@ -147,7 +147,7 @@ function collectASequenceOfCodePoints (condition, input, position) { let result = '' // 2. While position doesn’t point past the end of input and the - // code point at position within input meets the condition condition: + // code point at position within input meets the condition: while (position.position < input.length && condition(input[position.position])) { // 1. Append that code point to the end of result. result += input[position.position] @@ -219,7 +219,7 @@ function percentDecode (input) { /** @type {Uint8Array} */ const output = new Uint8Array(length) let j = 0 - // 2. For each byte byte in input: + // 2. For each byte in input: for (let i = 0; i < length; ++i) { const byte = input[i] diff --git a/lib/web/fetch/formdata-parser.js b/lib/web/fetch/formdata-parser.js index 90d4d2c7817..5a4a8da6e8c 100644 --- a/lib/web/fetch/formdata-parser.js +++ b/lib/web/fetch/formdata-parser.js @@ -183,7 +183,7 @@ function multipartFormDataParser (input, mimeType) { contentType = '' } - // 5.10.3. Let value be a new File object with name filename, type contentType, and body body. + // 5.10.3. Let value be a new File object with name filename, type contentType, and body. value = new File([body], filename, { type: contentType }) } else { // 5.11. Otherwise: diff --git a/lib/web/fetch/headers.js b/lib/web/fetch/headers.js index 39648ad1d02..86d3e60486a 100644 --- a/lib/web/fetch/headers.js +++ b/lib/web/fetch/headers.js @@ -37,7 +37,7 @@ function headerValueNormalize (potentialValue) { } function fill (headers, object) { - // To fill a Headers object headers with a given object object, run these steps: + // To fill a Headers object headers with a given object, run these steps: // 1. If object is a sequence, then for each header in object: // Note: webidl conversion to array has already been done. @@ -205,7 +205,7 @@ class HeadersList { * @param {boolean} isLowerCase */ contains (name, isLowerCase) { - // A header list list contains a header name name if list + // A header list contains a header name if list // contains a header whose name is a byte-case-insensitive // match for name. @@ -433,7 +433,7 @@ class Headers { // 2. If init is given, then fill this with init. if (init !== undefined) { - init = webidl.converters.HeadersInit(init, 'Headers contructor', 'init') + init = webidl.converters.HeadersInit(init, 'Headers constructor', 'init') fill(this, init) } } diff --git a/lib/web/fetch/index.js b/lib/web/fetch/index.js index b2c95d94a09..e185b4308d4 100644 --- a/lib/web/fetch/index.js +++ b/lib/web/fetch/index.js @@ -196,7 +196,7 @@ function fetch (input, init = undefined) { } ) - // 12. Let handleFetchDone given response response be to finalize and + // 12. Let handleFetchDone given response be to finalize and // report timing with response, globalObject, and "fetch". // see function handleFetchDone @@ -283,7 +283,7 @@ function finalizeAndReportTiming (response, initiatorType = 'other') { // 8. If response’s timing allow passed flag is not set, then: if (!response.timingAllowPassed) { - // 1. Set timingInfo to a the result of creating an opaque timing info for timingInfo. + // 1. Set timingInfo to the result of creating an opaque timing info for timingInfo. timingInfo = createOpaqueTimingInfo({ startTime: timingInfo.startTime }) @@ -1786,7 +1786,7 @@ async function httpNetworkFetch ( // 2. Otherwise, return a network error. - // To transmit request’s body body, run these steps: + // To transmit request’s body, run these steps: let requestBody = null // 1. If body is null and fetchParams’s process request end-of-body is // non-null, then queue a fetch task given fetchParams’s process request diff --git a/lib/web/fetch/response.js b/lib/web/fetch/response.js index 904752f6c98..a3db23dc1c5 100644 --- a/lib/web/fetch/response.js +++ b/lib/web/fetch/response.js @@ -71,7 +71,7 @@ class Response { return responseObject } - // Creates a redirect Response that redirects to url with status status. + // Creates a redirect Response that redirects to url with status. static redirect (url, status = 302) { webidl.argumentLengthCheck(arguments, 1, 'Response.redirect') @@ -333,7 +333,7 @@ Object.defineProperties(Response, { // https://fetch.spec.whatwg.org/#concept-response-clone function cloneResponse (response) { - // To clone a response response, run these steps: + // To clone a response, run these steps: // 1. If response is a filtered response, then return a new identical // filtered response whose internal response is a clone of response’s diff --git a/lib/web/fetch/util.js b/lib/web/fetch/util.js index daa2483c943..f0aca0512d9 100644 --- a/lib/web/fetch/util.js +++ b/lib/web/fetch/util.js @@ -172,7 +172,7 @@ function isValidHeaderValue (potentialValue) { // https://w3c.github.io/webappsec-referrer-policy/#set-requests-referrer-policy-on-redirect function setRequestReferrerPolicyOnRedirect (request, actualResponse) { - // Given a request request and a response actualResponse, this algorithm + // Given a request and a response actualResponse, this algorithm // updates request’s referrer policy according to the Referrer-Policy // header (if any) in actualResponse. @@ -881,7 +881,7 @@ function createIterator (name, kInternalIterator, keyIndex = 0, valueIndex = 1) } } - // 11. Let pair be the entry in values at index index. + // 11. Let pair be the entry in values at index. const { [keyIndex]: key, [valueIndex]: value } = values[index] // 12. Set object’s index to index + 1. @@ -1254,7 +1254,7 @@ function simpleRangeHeaderValue (value, allowWhitespace) { // 13. If allowWhitespace is true, collect a sequence of code points that are HTTP tab // or space, from data given position. - // Note from Khafra: its the same step as in #8 again lol + // Note from Khafra: it's the same step as in #8 again lol if (allowWhitespace) { collectASequenceOfCodePoints( (char) => char === '\t' || char === ' ', diff --git a/lib/web/fetch/webidl.js b/lib/web/fetch/webidl.js index 5397344e57b..77f31a51d66 100644 --- a/lib/web/fetch/webidl.js +++ b/lib/web/fetch/webidl.js @@ -522,7 +522,7 @@ webidl.converters['long long'] = function (V, prefix, argument) { // 1. Let x be ? ConvertToInt(V, 64, "signed"). const x = webidl.util.ConvertToInt(V, 64, 'signed', undefined, prefix, argument) - // 2. Return the IDL long long value that represents + // 2. Return the IDL long value that represents // the same numeric value as x. return x } @@ -532,7 +532,7 @@ webidl.converters['unsigned long long'] = function (V, prefix, argument) { // 1. Let x be ? ConvertToInt(V, 64, "unsigned"). const x = webidl.util.ConvertToInt(V, 64, 'unsigned', undefined, prefix, argument) - // 2. Return the IDL unsigned long long value that + // 2. Return the IDL unsigned long value that // represents the same numeric value as x. return x } diff --git a/test/fetch/headers.js b/test/fetch/headers.js index 38dd6b16886..e9d3d497732 100644 --- a/test/fetch/headers.js +++ b/test/fetch/headers.js @@ -26,7 +26,7 @@ test('Headers initialization', async (t) => { throws(() => new Headers(['undici', 'fetch', 'fetch']), TypeError) throws( () => new Headers([0, 1, 2]), - TypeError('Headers contructor: init[0] (0) is not iterable.') + TypeError('Headers constructor: init[0] (0) is not iterable.') ) }) @@ -41,7 +41,7 @@ test('Headers initialization', async (t) => { const init = ['undici', 'fetch', 'fetch', 'undici'] throws( () => new Headers(init), - TypeError('Headers contructor: init[0] ("undici") is not iterable.') + TypeError('Headers constructor: init[0] ("undici") is not iterable.') ) }) }) diff --git a/test/interceptors/retry.js b/test/interceptors/retry.js index 6e6f997cafa..d13b5966204 100644 --- a/test/interceptors/retry.js +++ b/test/interceptors/retry.js @@ -136,7 +136,7 @@ test('Should use retry-after header for retries (date)', async t => { let counter = 0 const server = createServer() let checkpoint - const reuestOptions = { + const requestOptions = { method: 'PUT', path: '/', headers: { @@ -182,7 +182,7 @@ test('Should use retry-after header for retries (date)', async t => { await once(server, 'close') }) - const response = await client.request(reuestOptions) + const response = await client.request(requestOptions) t.equal(response.statusCode, 200) t.equal(await response.body.text(), 'hello world!') diff --git a/test/mock-agent.js b/test/mock-agent.js index eb58afc6ad1..e8afa8b00d6 100644 --- a/test/mock-agent.js +++ b/test/mock-agent.js @@ -2357,7 +2357,7 @@ test('MockAgent - clients are not garbage collected', async (t) => { const baseUrl = `http://localhost:${server.address().port}` - // Create the dispatcher and isable net connect so we can make sure it matches properly + // Create the dispatcher and disable net connect so we can make sure it matches properly const dispatcher = new MockAgent() dispatcher.disableNetConnect() diff --git a/test/mock-interceptor-unused-assertions.js b/test/mock-interceptor-unused-assertions.js index 5be3942d3db..318907a8527 100644 --- a/test/mock-interceptor-unused-assertions.js +++ b/test/mock-interceptor-unused-assertions.js @@ -224,7 +224,7 @@ test('defaults to rendering output with terminal color when process.env.CI is un try { mockAgentWithOneInterceptor().assertNoPendingInterceptors() - t.fail('Shoudl have thrown') + t.fail('Should have thrown') } catch (err) { t.deepStrictEqual(err.message, tableRowsAlignedToLeft ? ` diff --git a/test/node-fetch/main.js b/test/node-fetch/main.js index 6d2e73b455d..4b584281ab6 100644 --- a/test/node-fetch/main.js +++ b/test/node-fetch/main.js @@ -735,7 +735,7 @@ describe('node-fetch', () => { }) .catch(() => { }) .then(new Promise((resolve) => { - // Wait a few ms to see if a uncaught error occurs + // Wait a few ms to see if an uncaught error occurs setTimeout(() => { resolve() }, 20) @@ -1231,7 +1231,7 @@ describe('node-fetch', () => { }) }) - // Body should been cloned... + // Body should be cloned... it('constructing a Request/Response with URLSearchParams and mutating it should not affected body', () => { const parameters = new URLSearchParams() const request = new Request(`${base}inspect`, { method: 'POST', body: parameters }) diff --git a/test/node-test/autoselectfamily.js b/test/node-test/autoselectfamily.js index 1c95296731f..48fa42341a7 100644 --- a/test/node-test/autoselectfamily.js +++ b/test/node-test/autoselectfamily.js @@ -36,7 +36,7 @@ function _lookup (resolver, hostname, options, cb) { } function createDnsServer (ipv6Addr, ipv4Addr, cb) { - // Create a DNS server which replies with a AAAA and a A record for the same host + // Create a DNS server which replies with an AAAA and an A record for the same host const socket = dgram.createSocket('udp4') socket.on('message', (msg, { address, port }) => { diff --git a/test/node-test/balanced-pool.js b/test/node-test/balanced-pool.js index eb9ab05b936..725c31ed190 100644 --- a/test/node-test/balanced-pool.js +++ b/test/node-test/balanced-pool.js @@ -501,7 +501,7 @@ describe('weighted round robin', () => { await Promise.all(servers.map(server => server.prepareForIteration(i))) - // send a request using undinci + // send a request using undici try { await client.request({ path: '/', method: 'GET' }) } catch (e) { diff --git a/test/node-test/tree.js b/test/node-test/tree.js index 778db4c7c39..feaf10eacf7 100644 --- a/test/node-test/tree.js +++ b/test/node-test/tree.js @@ -16,7 +16,7 @@ describe('Ternary Search Tree', () => { test('looking up not inserted key returns null', () => { const tst = new TernarySearchTree() tst.insert('a', 'a') - assert.strictEqual(tst.lookup(Buffer.from('non-existant')), null) + assert.strictEqual(tst.lookup(Buffer.from('non-existent')), null) }) test('not ascii string', () => { From 15abaf14bf75d904f21efeda326023f1dcdf1dde Mon Sep 17 00:00:00 2001 From: Nathan Baulch Date: Tue, 24 Sep 2024 12:10:49 +1000 Subject: [PATCH 2/3] Revert lib/web typos --- lib/web/eventsource/eventsource-stream.js | 2 +- lib/web/fetch/body.js | 10 +++++----- lib/web/fetch/data-url.js | 4 ++-- lib/web/fetch/formdata-parser.js | 2 +- lib/web/fetch/headers.js | 6 +++--- lib/web/fetch/index.js | 6 +++--- lib/web/fetch/response.js | 4 ++-- lib/web/fetch/util.js | 6 +++--- lib/web/fetch/webidl.js | 4 ++-- test/fetch/headers.js | 4 ++-- 10 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/web/eventsource/eventsource-stream.js b/lib/web/eventsource/eventsource-stream.js index 70cec9c2812..59cf7468800 100644 --- a/lib/web/eventsource/eventsource-stream.js +++ b/lib/web/eventsource/eventsource-stream.js @@ -196,7 +196,7 @@ class EventSourceStream extends Transform { // If the previous line ended with an end-of-line, we need to check // if the next character is also an end-of-line. if (this.eventEndCheck) { - // If the current character is an end-of-line, then the event + // If the the current character is an end-of-line, then the event // is finished and we can process it // If the previous line ended with a carriage return, we need to diff --git a/lib/web/fetch/body.js b/lib/web/fetch/body.js index f16adfd3828..83426cd586a 100644 --- a/lib/web/fetch/body.js +++ b/lib/web/fetch/body.js @@ -90,7 +90,7 @@ function extractBody (object, keepalive = false) { // URLSearchParams // spec says to run application/x-www-form-urlencoded on body.list - // this is implemented in Node.js as part of an URLSearchParams instance toString method + // this is implemented in Node.js as apart of an URLSearchParams instance toString method // See: https://github.com/nodejs/node/blob/e46c680bf2b211bbd52cf959ca17ee98c7f657f5/lib/internal/url.js#L490 // and https://github.com/nodejs/node/blob/e46c680bf2b211bbd52cf959ca17ee98c7f657f5/lib/internal/url.js#L1100 @@ -120,7 +120,7 @@ function extractBody (object, keepalive = false) { // Set action to this step: run the multipart/form-data // encoding algorithm, with object’s entry list and UTF-8. - // - This ensures that the body is immutable and can't be changed afterwards + // - This ensures that the body is immutable and can't be changed afterwords // - That the content-length is calculated in advance. // - And that all parts are pre-encoded and ready to be sent. @@ -215,7 +215,7 @@ function extractBody (object, keepalive = false) { length = Buffer.byteLength(source) } - // 12. If action is non-null, then run these steps in parallel: + // 12. If action is non-null, then run these steps in in parallel: if (action != null) { // Run action. let iterator @@ -262,7 +262,7 @@ function extractBody (object, keepalive = false) { // https://fetch.spec.whatwg.org/#bodyinit-safely-extract function safelyExtractBody (object, keepalive = false) { // To safely extract a body and a `Content-Type` value from - // a byte sequence or BodyInit object, run these steps: + // a byte sequence or BodyInit object object, run these steps: // 1. If object is a ReadableStream object, then: if (object instanceof ReadableStream) { @@ -278,7 +278,7 @@ function safelyExtractBody (object, keepalive = false) { } function cloneBody (instance, body) { - // To clone a body, run these steps: + // To clone a body body, run these steps: // https://fetch.spec.whatwg.org/#concept-body-clone diff --git a/lib/web/fetch/data-url.js b/lib/web/fetch/data-url.js index cdc1f82ba7b..2996feca92a 100644 --- a/lib/web/fetch/data-url.js +++ b/lib/web/fetch/data-url.js @@ -147,7 +147,7 @@ function collectASequenceOfCodePoints (condition, input, position) { let result = '' // 2. While position doesn’t point past the end of input and the - // code point at position within input meets the condition: + // code point at position within input meets the condition condition: while (position.position < input.length && condition(input[position.position])) { // 1. Append that code point to the end of result. result += input[position.position] @@ -219,7 +219,7 @@ function percentDecode (input) { /** @type {Uint8Array} */ const output = new Uint8Array(length) let j = 0 - // 2. For each byte in input: + // 2. For each byte byte in input: for (let i = 0; i < length; ++i) { const byte = input[i] diff --git a/lib/web/fetch/formdata-parser.js b/lib/web/fetch/formdata-parser.js index 5a4a8da6e8c..90d4d2c7817 100644 --- a/lib/web/fetch/formdata-parser.js +++ b/lib/web/fetch/formdata-parser.js @@ -183,7 +183,7 @@ function multipartFormDataParser (input, mimeType) { contentType = '' } - // 5.10.3. Let value be a new File object with name filename, type contentType, and body. + // 5.10.3. Let value be a new File object with name filename, type contentType, and body body. value = new File([body], filename, { type: contentType }) } else { // 5.11. Otherwise: diff --git a/lib/web/fetch/headers.js b/lib/web/fetch/headers.js index 86d3e60486a..39648ad1d02 100644 --- a/lib/web/fetch/headers.js +++ b/lib/web/fetch/headers.js @@ -37,7 +37,7 @@ function headerValueNormalize (potentialValue) { } function fill (headers, object) { - // To fill a Headers object headers with a given object, run these steps: + // To fill a Headers object headers with a given object object, run these steps: // 1. If object is a sequence, then for each header in object: // Note: webidl conversion to array has already been done. @@ -205,7 +205,7 @@ class HeadersList { * @param {boolean} isLowerCase */ contains (name, isLowerCase) { - // A header list contains a header name if list + // A header list list contains a header name name if list // contains a header whose name is a byte-case-insensitive // match for name. @@ -433,7 +433,7 @@ class Headers { // 2. If init is given, then fill this with init. if (init !== undefined) { - init = webidl.converters.HeadersInit(init, 'Headers constructor', 'init') + init = webidl.converters.HeadersInit(init, 'Headers contructor', 'init') fill(this, init) } } diff --git a/lib/web/fetch/index.js b/lib/web/fetch/index.js index e185b4308d4..b2c95d94a09 100644 --- a/lib/web/fetch/index.js +++ b/lib/web/fetch/index.js @@ -196,7 +196,7 @@ function fetch (input, init = undefined) { } ) - // 12. Let handleFetchDone given response be to finalize and + // 12. Let handleFetchDone given response response be to finalize and // report timing with response, globalObject, and "fetch". // see function handleFetchDone @@ -283,7 +283,7 @@ function finalizeAndReportTiming (response, initiatorType = 'other') { // 8. If response’s timing allow passed flag is not set, then: if (!response.timingAllowPassed) { - // 1. Set timingInfo to the result of creating an opaque timing info for timingInfo. + // 1. Set timingInfo to a the result of creating an opaque timing info for timingInfo. timingInfo = createOpaqueTimingInfo({ startTime: timingInfo.startTime }) @@ -1786,7 +1786,7 @@ async function httpNetworkFetch ( // 2. Otherwise, return a network error. - // To transmit request’s body, run these steps: + // To transmit request’s body body, run these steps: let requestBody = null // 1. If body is null and fetchParams’s process request end-of-body is // non-null, then queue a fetch task given fetchParams’s process request diff --git a/lib/web/fetch/response.js b/lib/web/fetch/response.js index a3db23dc1c5..904752f6c98 100644 --- a/lib/web/fetch/response.js +++ b/lib/web/fetch/response.js @@ -71,7 +71,7 @@ class Response { return responseObject } - // Creates a redirect Response that redirects to url with status. + // Creates a redirect Response that redirects to url with status status. static redirect (url, status = 302) { webidl.argumentLengthCheck(arguments, 1, 'Response.redirect') @@ -333,7 +333,7 @@ Object.defineProperties(Response, { // https://fetch.spec.whatwg.org/#concept-response-clone function cloneResponse (response) { - // To clone a response, run these steps: + // To clone a response response, run these steps: // 1. If response is a filtered response, then return a new identical // filtered response whose internal response is a clone of response’s diff --git a/lib/web/fetch/util.js b/lib/web/fetch/util.js index f0aca0512d9..daa2483c943 100644 --- a/lib/web/fetch/util.js +++ b/lib/web/fetch/util.js @@ -172,7 +172,7 @@ function isValidHeaderValue (potentialValue) { // https://w3c.github.io/webappsec-referrer-policy/#set-requests-referrer-policy-on-redirect function setRequestReferrerPolicyOnRedirect (request, actualResponse) { - // Given a request and a response actualResponse, this algorithm + // Given a request request and a response actualResponse, this algorithm // updates request’s referrer policy according to the Referrer-Policy // header (if any) in actualResponse. @@ -881,7 +881,7 @@ function createIterator (name, kInternalIterator, keyIndex = 0, valueIndex = 1) } } - // 11. Let pair be the entry in values at index. + // 11. Let pair be the entry in values at index index. const { [keyIndex]: key, [valueIndex]: value } = values[index] // 12. Set object’s index to index + 1. @@ -1254,7 +1254,7 @@ function simpleRangeHeaderValue (value, allowWhitespace) { // 13. If allowWhitespace is true, collect a sequence of code points that are HTTP tab // or space, from data given position. - // Note from Khafra: it's the same step as in #8 again lol + // Note from Khafra: its the same step as in #8 again lol if (allowWhitespace) { collectASequenceOfCodePoints( (char) => char === '\t' || char === ' ', diff --git a/lib/web/fetch/webidl.js b/lib/web/fetch/webidl.js index 77f31a51d66..5397344e57b 100644 --- a/lib/web/fetch/webidl.js +++ b/lib/web/fetch/webidl.js @@ -522,7 +522,7 @@ webidl.converters['long long'] = function (V, prefix, argument) { // 1. Let x be ? ConvertToInt(V, 64, "signed"). const x = webidl.util.ConvertToInt(V, 64, 'signed', undefined, prefix, argument) - // 2. Return the IDL long value that represents + // 2. Return the IDL long long value that represents // the same numeric value as x. return x } @@ -532,7 +532,7 @@ webidl.converters['unsigned long long'] = function (V, prefix, argument) { // 1. Let x be ? ConvertToInt(V, 64, "unsigned"). const x = webidl.util.ConvertToInt(V, 64, 'unsigned', undefined, prefix, argument) - // 2. Return the IDL unsigned long value that + // 2. Return the IDL unsigned long long value that // represents the same numeric value as x. return x } diff --git a/test/fetch/headers.js b/test/fetch/headers.js index e9d3d497732..38dd6b16886 100644 --- a/test/fetch/headers.js +++ b/test/fetch/headers.js @@ -26,7 +26,7 @@ test('Headers initialization', async (t) => { throws(() => new Headers(['undici', 'fetch', 'fetch']), TypeError) throws( () => new Headers([0, 1, 2]), - TypeError('Headers constructor: init[0] (0) is not iterable.') + TypeError('Headers contructor: init[0] (0) is not iterable.') ) }) @@ -41,7 +41,7 @@ test('Headers initialization', async (t) => { const init = ['undici', 'fetch', 'fetch', 'undici'] throws( () => new Headers(init), - TypeError('Headers constructor: init[0] ("undici") is not iterable.') + TypeError('Headers contructor: init[0] ("undici") is not iterable.') ) }) }) From 89853a4cf1a95649b715842fcc7944f631313dba Mon Sep 17 00:00:00 2001 From: Nathan Baulch Date: Tue, 24 Sep 2024 17:27:00 +1000 Subject: [PATCH 3/3] Revert OCCURED typo --- lib/llhttp/constants.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/llhttp/constants.js b/lib/llhttp/constants.js index 8e7f2918069..3e1dc01cdb5 100644 --- a/lib/llhttp/constants.js +++ b/lib/llhttp/constants.js @@ -222,7 +222,7 @@ exports.STATUSES = { WEB_SERVER_IS_DOWN: 521, // Unofficial CONNECTION_TIMEOUT: 522, // Unofficial ORIGIN_IS_UNREACHABLE: 523, // Unofficial - TIMEOUT_OCCURRED: 524, // Unofficial + TIMEOUT_OCCURED: 524, // Unofficial SSL_HANDSHAKE_FAILED: 525, // Unofficial INVALID_SSL_CERTIFICATE: 526, // Unofficial RAILGUN_ERROR: 527, // Unofficial @@ -401,7 +401,7 @@ exports.STATUSES_HTTP = [ exports.STATUSES.WEB_SERVER_IS_DOWN, exports.STATUSES.CONNECTION_TIMEOUT, exports.STATUSES.ORIGIN_IS_UNREACHABLE, - exports.STATUSES.TIMEOUT_OCCURRED, + exports.STATUSES.TIMEOUT_OCCURED, exports.STATUSES.SSL_HANDSHAKE_FAILED, exports.STATUSES.INVALID_SSL_CERTIFICATE, exports.STATUSES.RAILGUN_ERROR,