-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
deps: update undici to 7.5.0 #57427
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
Merged
Merged
deps: update undici to 7.5.0 #57427
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
# Class: MockCallHistory | ||
|
||
Access to an instance with : | ||
|
||
```js | ||
const mockAgent = new MockAgent({ enableCallHistory: true }) | ||
mockAgent.getCallHistory() | ||
|
||
// or | ||
const mockAgent = new MockAgent() | ||
mockAgent.enableMockHistory() | ||
mockAgent.getCallHistory() | ||
|
||
``` | ||
|
||
a MockCallHistory instance implements a **Symbol.iterator** letting you iterate on registered logs : | ||
|
||
```ts | ||
for (const log of mockAgent.getCallHistory()) { | ||
//... | ||
} | ||
|
||
const array: Array<MockCallHistoryLog> = [...mockAgent.getCallHistory()] | ||
const set: Set<MockCallHistoryLog> = new Set(mockAgent.getCallHistory()) | ||
``` | ||
|
||
## class methods | ||
|
||
### clear | ||
|
||
Clear all MockCallHistoryLog registered. This is automatically done when calling `mockAgent.close()` | ||
|
||
```js | ||
mockAgent.clearCallHistory() | ||
// same as | ||
mockAgent.getCallHistory()?.clear() | ||
``` | ||
|
||
### calls | ||
|
||
Get all MockCallHistoryLog registered as an array | ||
|
||
```js | ||
mockAgent.getCallHistory()?.calls() | ||
``` | ||
|
||
### firstCall | ||
|
||
Get the first MockCallHistoryLog registered or undefined | ||
|
||
```js | ||
mockAgent.getCallHistory()?.firstCall() | ||
``` | ||
|
||
### lastCall | ||
|
||
Get the last MockCallHistoryLog registered or undefined | ||
|
||
```js | ||
mockAgent.getCallHistory()?.lastCall() | ||
``` | ||
|
||
### nthCall | ||
|
||
Get the nth MockCallHistoryLog registered or undefined | ||
|
||
```js | ||
mockAgent.getCallHistory()?.nthCall(3) // the third MockCallHistoryLog registered | ||
``` | ||
|
||
### filterCallsByProtocol | ||
|
||
Filter MockCallHistoryLog by protocol. | ||
|
||
> more details for the first parameter can be found [here](/docs/docs/api/MockCallHistory.md#filter-parameter) | ||
|
||
```js | ||
mockAgent.getCallHistory()?.filterCallsByProtocol(/https/) | ||
mockAgent.getCallHistory()?.filterCallsByProtocol('https:') | ||
``` | ||
|
||
### filterCallsByHost | ||
|
||
Filter MockCallHistoryLog by host. | ||
|
||
> more details for the first parameter can be found [here](/docs/docs/api/MockCallHistory.md#filter-parameter) | ||
|
||
```js | ||
mockAgent.getCallHistory()?.filterCallsByHost(/localhost/) | ||
mockAgent.getCallHistory()?.filterCallsByHost('localhost:3000') | ||
``` | ||
|
||
### filterCallsByPort | ||
|
||
Filter MockCallHistoryLog by port. | ||
|
||
> more details for the first parameter can be found [here](/docs/docs/api/MockCallHistory.md#filter-parameter) | ||
|
||
```js | ||
mockAgent.getCallHistory()?.filterCallsByPort(/3000/) | ||
mockAgent.getCallHistory()?.filterCallsByPort('3000') | ||
mockAgent.getCallHistory()?.filterCallsByPort('') | ||
``` | ||
|
||
### filterCallsByOrigin | ||
|
||
Filter MockCallHistoryLog by origin. | ||
|
||
> more details for the first parameter can be found [here](/docs/docs/api/MockCallHistory.md#filter-parameter) | ||
|
||
```js | ||
mockAgent.getCallHistory()?.filterCallsByOrigin(/http:\/\/localhost:3000/) | ||
mockAgent.getCallHistory()?.filterCallsByOrigin('http://localhost:3000') | ||
``` | ||
|
||
### filterCallsByPath | ||
|
||
Filter MockCallHistoryLog by path. | ||
|
||
> more details for the first parameter can be found [here](/docs/docs/api/MockCallHistory.md#filter-parameter) | ||
|
||
```js | ||
mockAgent.getCallHistory()?.filterCallsByPath(/api\/v1\/graphql/) | ||
mockAgent.getCallHistory()?.filterCallsByPath('/api/v1/graphql') | ||
``` | ||
|
||
### filterCallsByHash | ||
|
||
Filter MockCallHistoryLog by hash. | ||
|
||
> more details for the first parameter can be found [here](/docs/docs/api/MockCallHistory.md#filter-parameter) | ||
|
||
```js | ||
mockAgent.getCallHistory()?.filterCallsByPath(/hash/) | ||
mockAgent.getCallHistory()?.filterCallsByPath('#hash') | ||
``` | ||
|
||
### filterCallsByFullUrl | ||
|
||
Filter MockCallHistoryLog by fullUrl. fullUrl contains protocol, host, port, path, hash, and query params | ||
|
||
> more details for the first parameter can be found [here](/docs/docs/api/MockCallHistory.md#filter-parameter) | ||
|
||
```js | ||
mockAgent.getCallHistory()?.filterCallsByFullUrl(/https:\/\/localhost:3000\/\?query=value#hash/) | ||
mockAgent.getCallHistory()?.filterCallsByFullUrl('https://localhost:3000/?query=value#hash') | ||
``` | ||
|
||
### filterCallsByMethod | ||
|
||
Filter MockCallHistoryLog by method. | ||
|
||
> more details for the first parameter can be found [here](/docs/docs/api/MockCallHistory.md#filter-parameter) | ||
|
||
```js | ||
mockAgent.getCallHistory()?.filterCallsByMethod(/POST/) | ||
mockAgent.getCallHistory()?.filterCallsByMethod('POST') | ||
``` | ||
|
||
### filterCalls | ||
|
||
This class method is a meta function / alias to apply complex filtering in a single way. | ||
|
||
Parameters : | ||
|
||
- criteria : the first parameter. a function, regexp or object. | ||
- function : filter MockCallHistoryLog when the function returns false | ||
- regexp : filter MockCallHistoryLog when the regexp does not match on MockCallHistoryLog.toString() ([see](./MockCallHistoryLog.md#to-string)) | ||
- object : an object with MockCallHistoryLog properties as keys to apply multiple filters. each values are a [filter parameter](/docs/docs/api/MockCallHistory.md#filter-parameter) | ||
- options : the second parameter. an object. | ||
- options.operator : `'AND'` or `'OR'` (default `'OR'`). Used only if criteria is an object. see below | ||
|
||
```js | ||
mockAgent.getCallHistory()?.filterCalls((log) => log.hash === value && log.headers?.['authorization'] !== undefined) | ||
mockAgent.getCallHistory()?.filterCalls(/"data": "{ "errors": "wrong body" }"/) | ||
|
||
// returns an Array of MockCallHistoryLog which all have | ||
// - a hash containing my-hash | ||
// - OR | ||
// - a path equal to /endpoint | ||
mockAgent.getCallHistory()?.filterCalls({ hash: /my-hash/, path: '/endpoint' }) | ||
|
||
// returns an Array of MockCallHistoryLog which all have | ||
// - a hash containing my-hash | ||
// - AND | ||
// - a path equal to /endpoint | ||
mockAgent.getCallHistory()?.filterCalls({ hash: /my-hash/, path: '/endpoint' }, { operator: 'AND' }) | ||
``` | ||
|
||
## filter parameter | ||
|
||
Can be : | ||
|
||
- string. MockCallHistoryLog filtered if `value !== parameterValue` | ||
- null. MockCallHistoryLog filtered if `value !== parameterValue` | ||
- undefined. MockCallHistoryLog filtered if `value !== parameterValue` | ||
- regexp. MockCallHistoryLog filtered if `!parameterValue.test(value)` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Class: MockCallHistoryLog | ||
|
||
Access to an instance with : | ||
|
||
```js | ||
const mockAgent = new MockAgent({ enableCallHistory: true }) | ||
mockAgent.getCallHistory()?.firstCall() | ||
``` | ||
|
||
## class properties | ||
|
||
- body `mockAgent.getCallHistory()?.firstCall()?.body` | ||
- headers `mockAgent.getCallHistory()?.firstCall()?.headers` an object | ||
- method `mockAgent.getCallHistory()?.firstCall()?.method` a string | ||
- fullUrl `mockAgent.getCallHistory()?.firstCall()?.fullUrl` a string containing the protocol, origin, path, query and hash | ||
- origin `mockAgent.getCallHistory()?.firstCall()?.origin` a string containing the protocol and the host | ||
- headers `mockAgent.getCallHistory()?.firstCall()?.headers` an object | ||
- path `mockAgent.getCallHistory()?.firstCall()?.path` a string always starting with `/` | ||
- searchParams `mockAgent.getCallHistory()?.firstCall()?.searchParams` an object | ||
- protocol `mockAgent.getCallHistory()?.firstCall()?.protocol` a string (`https:`) | ||
- host `mockAgent.getCallHistory()?.firstCall()?.host` a string | ||
- port `mockAgent.getCallHistory()?.firstCall()?.port` an empty string or a string containing numbers | ||
- hash `mockAgent.getCallHistory()?.firstCall()?.hash` an empty string or a string starting with `#` | ||
|
||
## class methods | ||
|
||
### toMap | ||
|
||
Returns a Map instance | ||
|
||
```js | ||
mockAgent.getCallHistory()?.firstCall()?.toMap()?.get('hash') | ||
// #hash | ||
``` | ||
|
||
### toString | ||
|
||
Returns a string computed with any class property name and value pair | ||
|
||
```js | ||
mockAgent.getCallHistory()?.firstCall()?.toString() | ||
// protocol->https:|host->localhost:4000|port->4000|origin->https://localhost:4000|path->/endpoint|hash->#here|searchParams->{"query":"value"}|fullUrl->https://localhost:4000/endpoint?query=value#here|method->PUT|body->"{ "data": "hello" }"|headers->{"content-type":"application/json"} | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.