Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: various typos #3640

Merged
merged 3 commits into from
Sep 30, 2024
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
2 changes: 1 addition & 1 deletion GOVERNANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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`

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/api/Debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/api/Dispatcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ The `RequestOptions.method` property should not be value `'CONNECT'`.
#### Parameter: `ResponseData`

* **statusCode** `number`
* **headers** `Record<string, string | string[]>` - Note that all header keys are lower-cased, e. g. `content-type`.
* **headers** `Record<string, string | string[]>` - 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<string, string>` - This object starts out
as empty and will be mutated to contain trailers after `body` has emitted `'end'`.
Expand Down Expand Up @@ -974,7 +974,7 @@ const client = new Client("http://example.com").compose(
})
);

// or
// or
client.dispatch(
{
path: "/",
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/api/MockPool.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NathanBaulch I also do random PR-s with typos.
How do you spot wrong indefinite articles?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IntelliJ highlights them. I usually only fix them if the PR I'm working on isn't getting too out of hand.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


* **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.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/api/RetryAgent.md
Original file line number Diff line number Diff line change
Expand Up @@ -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())
```
2 changes: 1 addition & 1 deletion docs/docs/api/RetryHandler.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ It represents the retry state for a given request.
- **dispatch** `(options: Dispatch.DispatchOptions, handlers: Dispatch.DispatchHandlers) => Promise<Dispatch.DispatchResponse>` (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:
Expand Down
2 changes: 1 addition & 1 deletion lib/api/readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
2 changes: 1 addition & 1 deletion lib/dispatcher/client-h2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion lib/handler/redirect-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/handler/retry-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down
4 changes: 2 additions & 2 deletions test/interceptors/retry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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!')
Expand Down
2 changes: 1 addition & 1 deletion test/mock-agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion test/mock-interceptor-unused-assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
? `
Expand Down
4 changes: 2 additions & 2 deletions test/node-fetch/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 })
Expand Down
2 changes: 1 addition & 1 deletion test/node-test/autoselectfamily.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand Down
2 changes: 1 addition & 1 deletion test/node-test/balanced-pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion test/node-test/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Loading