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: Fix typos #3985

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions docs/docs/api/CacheStore.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The `MemoryCacheStore` stores the responses in-memory.
**Options**

- `maxCount` - The maximum amount of responses to store. Default `Infinity`.
- `maxEntrySize` - The maximum size in bytes that a response's body can be. If a response's body is greater than or equal to this, the response will not be cached.
- `maxEntrySize` - The maximum size in bytes that a response body can be. If a response body is greater than or equal to this, the response will not be cached.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this wording good? I mean: The maximum size that a body can have?

Copy link
Author

Choose a reason for hiding this comment

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

I've never seen "response's body" in technical documents.
image
I need an LLM to argue.

Copy link
Author

Choose a reason for hiding this comment

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

In the HTTP standard it is called "message body".

Copy link
Author

Choose a reason for hiding this comment

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

Should I revert it?


### `SqliteCacheStore`

Expand All @@ -26,7 +26,7 @@ The `SqliteCacheStore` is only exposed if the `node:sqlite` api is present.

- `location` - The location of the SQLite database to use. Default `:memory:`.
- `maxCount` - The maximum number of entries to store in the database. Default `Infinity`.
- `maxEntrySize` - The maximum size in bytes that a resposne's body can be. If a response's body is greater than or equal to this, the response will not be cached. Default `Infinity`.
- `maxEntrySize` - The maximum size in bytes that a response body can be. If a response body is greater than or equal to this, the response will not be cached. Default `Infinity`.
Copy link
Contributor

Choose a reason for hiding this comment

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

the same as above


## Defining a Custom Cache Store

Expand All @@ -49,7 +49,7 @@ If the request isn't cached, `undefined` is returned.
Response properties:

* **response** `CacheValue` - The cached response data.
* **body** `Readable | undefined` - The response's body.
* **body** `Readable | undefined` - The response body.

### Function: `createWriteStream`

Expand All @@ -62,7 +62,7 @@ Returns: `Writable | undefined` - If the store is full, return `undefined`. Othe

## `CacheValue`

This is an interface containing the majority of a response's data (minus the body).
This is an interface containing the majority of a response data (minus the body).

### Property `statusCode`

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/api/ProxyAgent.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Returns: `ProxyAgent`
### Parameter: `ProxyAgentOptions`

Extends: [`AgentOptions`](/docs/docs/api/Agent.md#parameter-agentoptions)
> It ommits `AgentOptions#connect`.
> It omits `AgentOptions#connect`.

* **uri** `string | URL` (required) - The URI of the proxy server. This can be provided as a string, as an instance of the URL class, or as an object with a `uri` property of type string.
If the `uri` is provided as a string or `uri` is an object with an `uri` property of type string, then it will be parsed into a `URL` object according to the [WHATWG URL Specification](https://url.spec.whatwg.org).
Expand Down
2 changes: 1 addition & 1 deletion lib/handler/cache-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class CacheHandler {
!heuristicallyCacheable &&
!this.#cacheByDefault
) {
// Don't have anything to tell us this response is cachable and we're not
// Don't have anything to tell us this response is cacheable and we're not
// caching by default
return downstreamOnHeaders()
}
Expand Down
4 changes: 2 additions & 2 deletions lib/interceptor/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,11 @@ module.exports = (opts = {}) => {
assertCacheMethods(methods, 'opts.methods')

if (typeof cacheByDefault !== 'undefined' && typeof cacheByDefault !== 'number') {
throw new TypeError(`exepcted opts.cacheByDefault to be number or undefined, got ${typeof cacheByDefault}`)
throw new TypeError(`expected opts.cacheByDefault to be number or undefined, got ${typeof cacheByDefault}`)
}

if (typeof type !== 'undefined' && type !== 'shared' && type !== 'private') {
throw new TypeError(`exepcted opts.type to be shared, private, or undefined, got ${typeof type}`)
throw new TypeError(`expected opts.type to be shared, private, or undefined, got ${typeof type}`)
}

const globalOpts = {
Expand Down
2 changes: 1 addition & 1 deletion lib/util/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ function parseVaryHeader (varyHeader, headers) {

/**
* Note: this deviates from the spec a little. Empty etags ("", W/"") are valid,
* however, including them in cached resposnes serves little to no purpose.
* however, including them in cached responses serves little to no purpose.
*
* @see https://www.rfc-editor.org/rfc/rfc9110.html#name-etag
*
Expand Down
2 changes: 1 addition & 1 deletion lib/web/fetch/body.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion test/interceptors/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ describe('Cache Interceptor', () => {
'proxy-connection',
'te',
'upgrade',
// Headers we need to specifiy to be stripped
// Headers we need to specify to be stripped
'should-be-stripped'
]

Expand Down
6 changes: 3 additions & 3 deletions test/utils/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('parseHttpDate', () => {
'Sun, 06 Nov 1994 08:49:37 GMT': new Date(Date.UTC(1994, 10, 6, 8, 49, 37)),
'Thu, 18 Aug 1950 02:01:18 GMT': new Date(Date.UTC(1950, 7, 18, 2, 1, 18)),
'Wed, 11 Dec 2024 23:20:57 GMT': new Date(Date.UTC(2024, 11, 11, 23, 20, 57)),
'Wed, aa Dec 2024 23:20:57 GMT': undefined, // NaN daty
'Wed, aa Dec 2024 23:20:57 GMT': undefined, // NaN day
'aaa, 06 Dec 2024 23:20:57 GMT': undefined, // Invalid day name
'Wed, 01 aaa 2024 23:20:57 GMT': undefined, // Invalid month
'Wed, 6 Dec 2024 23:20:07 GMT': undefined, // No leading zero
Expand All @@ -33,7 +33,7 @@ describe('parseHttpDate', () => {
'Sunday, 06-Nov-94 08:49:37 GMT': new Date(Date.UTC(1994, 10, 6, 8, 49, 37)),
'Thursday, 18-Aug-50 02:01:18 GMT': new Date(Date.UTC(2050, 7, 18, 2, 1, 18)),
'Wednesday, 11-Dec-24 23:20:57 GMT': new Date(Date.UTC(2024, 11, 11, 23, 20, 57)),
'Wednesday, aa Dec 2024 23:20:57 GMT': undefined, // NaN daty
'Wednesday, aa Dec 2024 23:20:57 GMT': undefined, // NaN day
'aaa, 06 Dec 2024 23:20:57 GMT': undefined, // Invalid day name
'Wednesday, 01-aaa-24 23:20:57 GMT': undefined, // Invalid month
'Wednesday, 6-Dec-24 23:20:07 GMT': undefined, // No leading zero
Expand All @@ -56,7 +56,7 @@ describe('parseHttpDate', () => {
'Sun Nov 6 08:49:37 1994': new Date(Date.UTC(1994, 10, 6, 8, 49, 37)),
'Thu Aug 18 02:01:18 1950': new Date(Date.UTC(1950, 7, 18, 2, 1, 18)),
'Wed Dec 11 23:20:57 2024': new Date(Date.UTC(2024, 11, 11, 23, 20, 57)),
'Wed Dec aa 23:20:57 2024': undefined, // NaN daty
'Wed Dec aa 23:20:57 2024': undefined, // NaN day
'aaa Dec 06 23:20:57 2024': undefined, // Invalid day name
'Wed aaa 01 23:20:57 2024': undefined, // Invalid month
'Wed Dec 6 23:20:07 2024': undefined, // No leading zero
Expand Down
2 changes: 1 addition & 1 deletion test/websocket/issue-2844.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test('The server must reply with at least one subprotocol the client sends', asy
await completed
})

test('The connection fails when the client sends subprotocols that the server does not responc with', async (t) => {
test('The connection fails when the client sends subprotocols that the server does not respond with', async (t) => {
const { completed, fail, ok } = tspl(t, { plan: 1 })

const wss = new WebSocketServer({
Expand Down