feat: use AsyncLocalStorage to store request state #1344
Annotations
10 errors and 4 warnings
Run Test:
test/diagnostics_channel.test.ts#L75
TypeError: Cannot read properties of undefined (reading 'tracer')
❯ test/diagnostics_channel.test.ts:75:36
|
Run Test:
test/fetch.test.ts#L49
AssertionError: false == true
- Expected
+ Received
- true
+ false
❯ test/fetch.test.ts:49:5
|
Run Test:
test/fetch.test.ts#L91
AssertionError: false == true
- Expected
+ Received
- true
+ false
❯ test/fetch.test.ts:91:5
|
Run Test:
test/index.test.ts#L64
AssertionError: The expression evaluated to a falsy value:
it('should response set-cookie as an array string', async () => {
const response = await urllib.request(`${_url}set-two-cookie`);
assert.equal(response.status, 200);
assert(Array.isArray(response.headers['set-cookie']));
assert.equal(typeof response.headers['set-cookie'], 'object');
assert.deepEqual(response.headers['set-cookie'], [
'foo=bar; path=/',
'hello=world; path=/',
]);
assert.equal(response.headers['Set-Cookie'], undefined);
})
- Expected
+ Received
- true
+ false
❯ test/index.test.ts:64:7
|
Run Test:
test/index.test.ts#L237
AssertionError: Expected values to be strictly equal:
200 !== 400
- Expected
+ Received
- 400
+ 200
❯ test/index.test.ts:237:14
|
Run Test:
test/index.test.ts#L284
AssertionError: The input did not match the regular expression /mock response stream/. Input:
'{"method":"GET","url":"/foo.js","href":"http://localhost/foo.js","headers":{"host":"localhost","connection":"keep-alive","user-agent":"node-urllib/VERSION Node.js/18.19.0 (win32; x64)"},"requestBody":""}'
- Expected:
/mock response stream/
+ Received:
"{\"method\":\"GET\",\"url\":\"/foo.js\",\"href\":\"http://localhost/foo.js\",\"headers\":{\"host\":\"localhost\",\"connection\":\"keep-alive\",\"user-agent\":\"node-urllib/VERSION Node.js/18.19.0 (win32; x64)\"},\"requestBody\":\"\"}"
❯ test/index.test.ts:284:14
|
Run Test:
test/keep-alive-header.test.ts#L151
TypeError: Cannot read properties of undefined (reading 'connected')
❯ test/keep-alive-header.test.ts:151:60
|
Run Test:
test/options.digestAuth.test.ts#L36
AssertionError: Expected values to be strictly equal:
401 !== 200
- Expected
+ Received
- 200
+ 401
❯ test/options.digestAuth.test.ts:36:12
|
Run Test:
src/HttpClient.ts#L746
HttpClientRequestTimeoutError: Request timeout for 5000 ms
❯ HttpClient.#requestInternal src/HttpClient.ts:746:15
❯ HttpClient.#requestInternal src/HttpClient.ts:647:18
❯ src/HttpClient.ts:256:14
❯ HttpClient.request src/HttpClient.ts:255:12
❯ Object.request src/index.ts:31:10
❯ test/options.followRedirect.test.ts:97:57
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { status: 302, headers: { 'keep-alive': 'timeout=5', 'x-requests-persocket': '9', 'x-requests-socket-port': '62084', 'x-foo': 'bar', 'x-href': 'http://localhost/redirect-full', 'x-method': 'GET', 'x-request-headers': '{"host":"localhost","connection":"keep-alive","user-agent":"node-urllib/VERSION Node.js/18.19.0 (win32; x64)"}', location: 'http://localhost/redirect-full-to-url', date: 'Thu, 05 Dec 2024 14:49:48 GMT', connection: 'keep-alive', 'content-length': '49' }, socket: { id: 5, localAddress: '::1', localPort: 62088, remoteAddress: '::1', remotePort: 80, remoteFamily: 'IPv6', bytesWritten: 141, bytesRead: +0, handledRequests: 1, handledResponses: +0, connectedTime: '2024-12-05T14:49:48.447Z', lastRequestEndTime: '2024-12-05T14:49:53.932Z' }, res: { status: 302, statusCode: 302, statusText: 'Found', statusMessage: 'Found', headers: { 'keep-alive': 'timeout=5', 'x-requests-persocket': '9', 'x-requests-socket-port': '62084', 'x-foo': 'bar', 'x-href': 'http://localhost/redirect-full', 'x-method': 'GET', 'x-request-headers': '{"host":"localhost","connection":"keep-alive","user-agent":"node-urllib/VERSION Node.js/18.19.0 (win32; x64)"}', location: 'http://localhost/redirect-full-to-url', date: 'Thu, 05 Dec 2024 14:49:48 GMT', connection: 'keep-alive', 'content-length': '49' }, size: 49, aborted: false, rt: 5486.771, keepAliveSocket: true, requestUrls: [ 'http://localhost:62083/redirect-full', 'http://localhost/redirect-full-to-url' ], timing: { queuing: +0, dnslookup: +0, connected: +0, requestHeadersSent: +0, requestSent: +0, waiting: +0, contentDownload: +0 }, socket: { id: 5, localAddress: '::1', localPort: 62088, remoteAddress: '::1', remotePort: 80, remoteFamily: 'IPv6', bytesWritten: 141, bytesRead: +0, handledRequests: 1, handledResponses: +0, connectedTime: '2024-12-05T14:49:48.447Z', lastRequestEndTime: '2024-12-05T14:49:53.932Z' }, retries: +0, socketErrorRetries: +0 }, opaque: undefined, _rawSocket: { id: 5, localAddress: '::1', localPort: 62088, remoteAddress: '::1', remotePort: 80, remoteFamily: 'IPv6', bytesWritten: 141, bytesRead: +0, handledRequests: 1, handledResponses: +0, connectedTime: '2024-12-05T14:49:48.447Z' } }
Caused by: Caused by: HeadersTimeoutError: Headers Timeout Error
❯ FastTimer.onParserTimeout [as _onTimeout] node_modules/undici/lib/dispatcher/client-h1.js:751:28
❯ Timeout.onTick [as _onTimeout] node_modules/undici/lib/util/timers.js:162:13
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { code: 'UND_ERR_HEADERS_TIMEOUT' }
|
Run Test:
src/HttpClient.ts#L746
HttpClientRequestTimeoutError: Request timeout for 5000 ms
❯ HttpClient.#requestInternal src/HttpClient.ts:746:15
❯ HttpClient.#requestInternal src/HttpClient.ts:647:18
❯ src/HttpClient.ts:256:14
❯ HttpClient.request src/HttpClient.ts:255:12
❯ Object.request src/index.ts:31:10
❯ test/options.followRedirect.test.ts:110:57
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { status: 301, headers: { 'keep-alive': 'timeout=5', 'x-requests-persocket': '1', 'x-requests-socket-port': '62111', 'x-foo': 'bar', 'x-href': 'http://localhost/redirect-full-301', 'x-method': 'GET', 'x-request-headers': '{"host":"localhost","connection":"keep-alive","user-agent":"node-urllib/VERSION Node.js/18.19.0 (win32; x64)"}', location: 'http://localhost/redirect-full-301-to-url', date: 'Thu, 05 Dec 2024 14:49:53 GMT', connection: 'keep-alive', 'content-length': '53' }, socket: { id: 7, localAddress: '::1', localPort: 62112, remoteAddress: '::1', remotePort: 80, remoteFamily: 'IPv6', bytesWritten: 145, bytesRead: +0, handledRequests: 1, handledResponses: +0, connectedTime: '2024-12-05T14:49:53.946Z', lastRequestEndTime: '2024-12-05T14:49:59.459Z' }, res: { status: 301, statusCode: 301, statusText: 'Moved Permanently', statusMessage: 'Moved Permanently', headers: { 'keep-alive': 'timeout=5', 'x-requests-persocket': '1', 'x-requests-socket-port': '62111', 'x-foo': 'bar', 'x-href': 'http://localhost/redirect-full-301', 'x-method': 'GET', 'x-request-headers': '{"host":"localhost","connection":"keep-alive","user-agent":"node-urllib/VERSION Node.js/18.19.0 (win32; x64)"}', location: 'http://localhost/redirect-full-301-to-url', date: 'Thu, 05 Dec 2024 14:49:53 GMT', connection: 'keep-alive', 'content-length': '53' }, size: 53, aborted: false, rt: 5515.51, keepAliveSocket: true, requestUrls: [ 'http://localhost:62083/redirect-full-301', 'http://localhost/redirect-full-301-to-url' ], timing: { queuing: +0, dnslookup: +0, connected: +0, requestHeadersSent: +0, requestSent: +0, waiting: +0, contentDownload: +0 }, socket: { id: 7, localAddress: '::1', localPort: 62112, remoteAddress: '::1', remotePort: 80, remoteFamily: 'IPv6', bytesWritten: 145, bytesRead: +0, handledRequests: 1, handledResponses: +0, connectedTime: '2024-12-05T14:49:53.946Z', lastRequestEndTime: '2024-12-05T14:49:59.459Z' }, retries: +0, socketErrorRetries: +0 }, opaque: undefined, _rawSocket: { id: 7, localAddress: '::1', localPort: 62112, remoteAddress: '::1', remotePort: 80, remoteFamily: 'IPv6', bytesWritten: 145, bytesRead: +0, handledRequests: 1, handledResponses: +0, connectedTime: '2024-12-05T14:49:53.946Z' } }
Caused by: Caused by: HeadersTimeoutError: Headers Timeout Error
❯ FastTimer.onParserTimeout [as _onTimeout] node_modules/undici/lib/dispatcher/client-h1.js:751:28
❯ Timeout.onTick [as _onTimeout] node_modules/undici/lib/util/timers.js:162:13
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { code: 'UND_ERR_HEADERS_TIMEOUT' }
|
Run Test:
test/HttpClient.test.ts#L38
it.only not permitted
|
Run Test:
test/options.timing.test.ts#L20
it.only not permitted
|
Run Lint:
test/HttpClient.test.ts#L38
it.only not permitted
|
Run Lint:
test/options.timing.test.ts#L20
it.only not permitted
|
Loading