From 29473db6f8124e74bc2919ca08a4b715fdc1ce5a Mon Sep 17 00:00:00 2001 From: Nathan Baulch Date: Tue, 1 Oct 2024 08:33:38 +1000 Subject: [PATCH] fix: various typos (#3640) * Fix typos * Revert lib/web typos * Revert OCCURED typo --- 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 ++-- 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 +- 18 files changed, 23 insertions(+), 23 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 c44abf5231b..3a0dfb8e400 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/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', () => {