undici 7.13.0 → 7.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +5 -5
  2. package/docs/docs/api/DiagnosticsChannel.md +25 -1
  3. package/docs/docs/api/Dispatcher.md +59 -0
  4. package/index.js +2 -1
  5. package/lib/core/util.js +13 -1
  6. package/lib/dispatcher/agent.js +25 -16
  7. package/lib/dispatcher/client-h1.js +1 -1
  8. package/lib/dispatcher/proxy-agent.js +1 -2
  9. package/lib/handler/cache-handler.js +22 -4
  10. package/lib/interceptor/cache.js +2 -2
  11. package/lib/interceptor/decompress.js +253 -0
  12. package/lib/llhttp/constants.d.ts +99 -1
  13. package/lib/llhttp/constants.js +34 -1
  14. package/lib/llhttp/llhttp-wasm.js +1 -1
  15. package/lib/llhttp/llhttp_simd-wasm.js +1 -1
  16. package/lib/llhttp/utils.d.ts +2 -2
  17. package/lib/llhttp/utils.js +3 -6
  18. package/lib/mock/snapshot-agent.js +73 -59
  19. package/lib/mock/snapshot-recorder.js +254 -191
  20. package/lib/mock/snapshot-utils.js +158 -0
  21. package/lib/util/cache.js +9 -10
  22. package/lib/web/cache/cache.js +4 -4
  23. package/lib/web/cookies/parse.js +2 -2
  24. package/lib/web/eventsource/eventsource.js +17 -2
  25. package/lib/web/fetch/body.js +4 -4
  26. package/lib/web/fetch/formdata.js +1 -1
  27. package/lib/web/fetch/index.js +1 -1
  28. package/lib/web/fetch/response.js +8 -4
  29. package/lib/web/fetch/util.js +0 -216
  30. package/lib/web/subresource-integrity/Readme.md +9 -0
  31. package/lib/web/subresource-integrity/subresource-integrity.js +306 -0
  32. package/lib/web/websocket/stream/websocketstream.js +2 -2
  33. package/lib/web/websocket/websocket.js +11 -4
  34. package/package.json +8 -7
  35. package/types/diagnostics-channel.d.ts +0 -1
  36. package/types/eventsource.d.ts +6 -1
  37. package/types/index.d.ts +4 -1
  38. package/types/interceptors.d.ts +5 -0
  39. package/types/snapshot-agent.d.ts +5 -3
  40. package/lib/api/util.js +0 -95
  41. package/lib/llhttp/constants.js.map +0 -1
  42. package/lib/llhttp/utils.js.map +0 -1
@@ -0,0 +1,306 @@
1
+ 'use strict'
2
+
3
+ const assert = require('node:assert')
4
+
5
+ /**
6
+ * @typedef {object} Metadata
7
+ * @property {SRIHashAlgorithm} alg - The algorithm used for the hash.
8
+ * @property {string} val - The base64-encoded hash value.
9
+ */
10
+
11
+ /**
12
+ * @typedef {Metadata[]} MetadataList
13
+ */
14
+
15
+ /**
16
+ * @typedef {('sha256' | 'sha384' | 'sha512')} SRIHashAlgorithm
17
+ */
18
+
19
+ /**
20
+ * @type {Map<SRIHashAlgorithm, number>}
21
+ *
22
+ * The valid SRI hash algorithm token set is the ordered set « "sha256",
23
+ * "sha384", "sha512" » (corresponding to SHA-256, SHA-384, and SHA-512
24
+ * respectively). The ordering of this set is meaningful, with stronger
25
+ * algorithms appearing later in the set.
26
+ *
27
+ * @see https://w3c.github.io/webappsec-subresource-integrity/#valid-sri-hash-algorithm-token-set
28
+ */
29
+ const validSRIHashAlgorithmTokenSet = new Map([['sha256', 0], ['sha384', 1], ['sha512', 2]])
30
+
31
+ // https://nodejs.org/api/crypto.html#determining-if-crypto-support-is-unavailable
32
+ /** @type {import('crypto')} */
33
+ let crypto
34
+ try {
35
+ crypto = require('node:crypto')
36
+ const cryptoHashes = crypto.getHashes()
37
+
38
+ // If no hashes are available, we cannot support SRI.
39
+ if (cryptoHashes.length === 0) {
40
+ validSRIHashAlgorithmTokenSet.clear()
41
+ }
42
+
43
+ for (const algorithm of validSRIHashAlgorithmTokenSet.keys()) {
44
+ // If the algorithm is not supported, remove it from the list.
45
+ if (cryptoHashes.includes(algorithm) === false) {
46
+ validSRIHashAlgorithmTokenSet.delete(algorithm)
47
+ }
48
+ }
49
+ /* c8 ignore next 4 */
50
+ } catch {
51
+ // If crypto is not available, we cannot support SRI.
52
+ validSRIHashAlgorithmTokenSet.clear()
53
+ }
54
+
55
+ /**
56
+ * @typedef GetSRIHashAlgorithmIndex
57
+ * @type {(algorithm: SRIHashAlgorithm) => number}
58
+ * @param {SRIHashAlgorithm} algorithm
59
+ * @returns {number} The index of the algorithm in the valid SRI hash algorithm
60
+ * token set.
61
+ */
62
+
63
+ const getSRIHashAlgorithmIndex = /** @type {GetSRIHashAlgorithmIndex} */ (Map.prototype.get.bind(
64
+ validSRIHashAlgorithmTokenSet))
65
+
66
+ /**
67
+ * @typedef IsValidSRIHashAlgorithm
68
+ * @type {(algorithm: string) => algorithm is SRIHashAlgorithm}
69
+ * @param {*} algorithm
70
+ * @returns {algorithm is SRIHashAlgorithm}
71
+ */
72
+
73
+ const isValidSRIHashAlgorithm = /** @type {IsValidSRIHashAlgorithm} */ (
74
+ Map.prototype.has.bind(validSRIHashAlgorithmTokenSet)
75
+ )
76
+
77
+ /**
78
+ * @param {Uint8Array} bytes
79
+ * @param {string} metadataList
80
+ * @returns {boolean}
81
+ *
82
+ * @see https://w3c.github.io/webappsec-subresource-integrity/#does-response-match-metadatalist
83
+ */
84
+ const bytesMatch = crypto === undefined || validSRIHashAlgorithmTokenSet.size === 0
85
+ // If node is not built with OpenSSL support, we cannot check
86
+ // a request's integrity, so allow it by default (the spec will
87
+ // allow requests if an invalid hash is given, as precedence).
88
+ ? () => true
89
+ : (bytes, metadataList) => {
90
+ // 1. Let parsedMetadata be the result of parsing metadataList.
91
+ const parsedMetadata = parseMetadata(metadataList)
92
+
93
+ // 2. If parsedMetadata is empty set, return true.
94
+ if (parsedMetadata.length === 0) {
95
+ return true
96
+ }
97
+
98
+ // 3. Let metadata be the result of getting the strongest
99
+ // metadata from parsedMetadata.
100
+ const metadata = getStrongestMetadata(parsedMetadata)
101
+
102
+ // 4. For each item in metadata:
103
+ for (const item of metadata) {
104
+ // 1. Let algorithm be the item["alg"].
105
+ const algorithm = item.alg
106
+
107
+ // 2. Let expectedValue be the item["val"].
108
+ const expectedValue = item.val
109
+
110
+ // See https://github.com/web-platform-tests/wpt/commit/e4c5cc7a5e48093220528dfdd1c4012dc3837a0e
111
+ // "be liberal with padding". This is annoying, and it's not even in the spec.
112
+
113
+ // 3. Let actualValue be the result of applying algorithm to bytes .
114
+ const actualValue = applyAlgorithmToBytes(algorithm, bytes)
115
+
116
+ // 4. If actualValue is a case-sensitive match for expectedValue,
117
+ // return true.
118
+ if (caseSensitiveMatch(actualValue, expectedValue)) {
119
+ return true
120
+ }
121
+ }
122
+
123
+ // 5. Return false.
124
+ return false
125
+ }
126
+
127
+ /**
128
+ * @param {MetadataList} metadataList
129
+ * @returns {MetadataList} The strongest hash algorithm from the metadata list.
130
+ */
131
+ function getStrongestMetadata (metadataList) {
132
+ // 1. Let result be the empty set and strongest be the empty string.
133
+ const result = []
134
+ /** @type {Metadata|null} */
135
+ let strongest = null
136
+
137
+ // 2. For each item in set:
138
+ for (const item of metadataList) {
139
+ // 1. Assert: item["alg"] is a valid SRI hash algorithm token.
140
+ assert(isValidSRIHashAlgorithm(item.alg), 'Invalid SRI hash algorithm token')
141
+
142
+ // 2. If result is the empty set, then:
143
+ if (result.length === 0) {
144
+ // 1. Append item to result.
145
+ result.push(item)
146
+
147
+ // 2. Set strongest to item.
148
+ strongest = item
149
+
150
+ // 3. Continue.
151
+ continue
152
+ }
153
+
154
+ // 3. Let currentAlgorithm be strongest["alg"], and currentAlgorithmIndex be
155
+ // the index of currentAlgorithm in the valid SRI hash algorithm token set.
156
+ const currentAlgorithm = /** @type {Metadata} */ (strongest).alg
157
+ const currentAlgorithmIndex = getSRIHashAlgorithmIndex(currentAlgorithm)
158
+
159
+ // 4. Let newAlgorithm be the item["alg"], and newAlgorithmIndex be the
160
+ // index of newAlgorithm in the valid SRI hash algorithm token set.
161
+ const newAlgorithm = item.alg
162
+ const newAlgorithmIndex = getSRIHashAlgorithmIndex(newAlgorithm)
163
+
164
+ // 5. If newAlgorithmIndex is less than currentAlgorithmIndex, then continue.
165
+ if (newAlgorithmIndex < currentAlgorithmIndex) {
166
+ continue
167
+
168
+ // 6. Otherwise, if newAlgorithmIndex is greater than
169
+ // currentAlgorithmIndex:
170
+ } else if (newAlgorithmIndex > currentAlgorithmIndex) {
171
+ // 1. Set strongest to item.
172
+ strongest = item
173
+
174
+ // 2. Set result to « item ».
175
+ result[0] = item
176
+ result.length = 1
177
+
178
+ // 7. Otherwise, newAlgorithmIndex and currentAlgorithmIndex are the same
179
+ // value. Append item to result.
180
+ } else {
181
+ result.push(item)
182
+ }
183
+ }
184
+
185
+ // 3. Return result.
186
+ return result
187
+ }
188
+
189
+ /**
190
+ * @param {string} metadata
191
+ * @returns {MetadataList}
192
+ *
193
+ * @see https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata
194
+ */
195
+ function parseMetadata (metadata) {
196
+ // 1. Let result be the empty set.
197
+ /** @type {MetadataList} */
198
+ const result = []
199
+
200
+ // 2. For each item returned by splitting metadata on spaces:
201
+ for (const item of metadata.split(' ')) {
202
+ // 1. Let expression-and-options be the result of splitting item on U+003F (?).
203
+ const expressionAndOptions = item.split('?', 1)
204
+
205
+ // 2. Let algorithm-expression be expression-and-options[0].
206
+ const algorithmExpression = expressionAndOptions[0]
207
+
208
+ // 3. Let base64-value be the empty string.
209
+ let base64Value = ''
210
+
211
+ // 4. Let algorithm-and-value be the result of splitting algorithm-expression on U+002D (-).
212
+ const algorithmAndValue = [algorithmExpression.slice(0, 6), algorithmExpression.slice(7)]
213
+
214
+ // 5. Let algorithm be algorithm-and-value[0].
215
+ const algorithm = algorithmAndValue[0]
216
+
217
+ // 6. If algorithm is not a valid SRI hash algorithm token, then continue.
218
+ if (!isValidSRIHashAlgorithm(algorithm)) {
219
+ continue
220
+ }
221
+
222
+ // 7. If algorithm-and-value[1] exists, set base64-value to
223
+ // algorithm-and-value[1].
224
+ if (algorithmAndValue[1]) {
225
+ base64Value = algorithmAndValue[1]
226
+ }
227
+
228
+ // 8. Let metadata be the ordered map
229
+ // «["alg" → algorithm, "val" → base64-value]».
230
+ const metadata = {
231
+ alg: algorithm,
232
+ val: base64Value
233
+ }
234
+
235
+ // 9. Append metadata to result.
236
+ result.push(metadata)
237
+ }
238
+
239
+ // 3. Return result.
240
+ return result
241
+ }
242
+
243
+ /**
244
+ * Applies the specified hash algorithm to the given bytes
245
+ *
246
+ * @typedef {(algorithm: SRIHashAlgorithm, bytes: Uint8Array) => string} ApplyAlgorithmToBytes
247
+ * @param {SRIHashAlgorithm} algorithm
248
+ * @param {Uint8Array} bytes
249
+ * @returns {string}
250
+ */
251
+ const applyAlgorithmToBytes = (algorithm, bytes) => {
252
+ return crypto.hash(algorithm, bytes, 'base64')
253
+ }
254
+
255
+ /**
256
+ * Compares two base64 strings, allowing for base64url
257
+ * in the second string.
258
+ *
259
+ * @param {string} actualValue base64 encoded string
260
+ * @param {string} expectedValue base64 or base64url encoded string
261
+ * @returns {boolean}
262
+ */
263
+ function caseSensitiveMatch (actualValue, expectedValue) {
264
+ // Ignore padding characters from the end of the strings by
265
+ // decreasing the length by 1 or 2 if the last characters are `=`.
266
+ let actualValueLength = actualValue.length
267
+ if (actualValueLength !== 0 && actualValue[actualValueLength - 1] === '=') {
268
+ actualValueLength -= 1
269
+ }
270
+ if (actualValueLength !== 0 && actualValue[actualValueLength - 1] === '=') {
271
+ actualValueLength -= 1
272
+ }
273
+ let expectedValueLength = expectedValue.length
274
+ if (expectedValueLength !== 0 && expectedValue[expectedValueLength - 1] === '=') {
275
+ expectedValueLength -= 1
276
+ }
277
+ if (expectedValueLength !== 0 && expectedValue[expectedValueLength - 1] === '=') {
278
+ expectedValueLength -= 1
279
+ }
280
+
281
+ if (actualValueLength !== expectedValueLength) {
282
+ return false
283
+ }
284
+
285
+ for (let i = 0; i < actualValueLength; ++i) {
286
+ if (
287
+ actualValue[i] === expectedValue[i] ||
288
+ (actualValue[i] === '+' && expectedValue[i] === '-') ||
289
+ (actualValue[i] === '/' && expectedValue[i] === '_')
290
+ ) {
291
+ continue
292
+ }
293
+ return false
294
+ }
295
+
296
+ return true
297
+ }
298
+
299
+ module.exports = {
300
+ applyAlgorithmToBytes,
301
+ bytesMatch,
302
+ caseSensitiveMatch,
303
+ isValidSRIHashAlgorithm,
304
+ getStrongestMetadata,
305
+ parseMetadata
306
+ }
@@ -6,7 +6,7 @@ const { states, opcodes, sentCloseFrameState } = require('../constants')
6
6
  const { webidl } = require('../../webidl')
7
7
  const { getURLRecord, isValidSubprotocol, isEstablished, utf8Decode } = require('../util')
8
8
  const { establishWebSocketConnection, failWebsocketConnection, closeWebSocketConnection } = require('../connection')
9
- const { types } = require('node:util')
9
+ const { isArrayBuffer } = require('node:util/types')
10
10
  const { channels } = require('../../../core/diagnostics')
11
11
  const { WebsocketFrameSend } = require('../frame')
12
12
  const { ByteParser } = require('../receiver')
@@ -210,7 +210,7 @@ class WebSocketStream {
210
210
  let opcode = null
211
211
 
212
212
  // 4. If chunk is a BufferSource ,
213
- if (ArrayBuffer.isView(chunk) || types.isArrayBuffer(chunk)) {
213
+ if (ArrayBuffer.isView(chunk) || isArrayBuffer(chunk)) {
214
214
  // 4.1. Set data to a copy of the bytes given chunk .
215
215
  data = new Uint8Array(ArrayBuffer.isView(chunk) ? new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength) : chunk)
216
216
 
@@ -1,5 +1,6 @@
1
1
  'use strict'
2
2
 
3
+ const { isArrayBuffer } = require('node:util/types')
3
4
  const { webidl } = require('../webidl')
4
5
  const { URLSerializer } = require('../fetch/data-url')
5
6
  const { environmentSettingsObject } = require('../fetch/util')
@@ -19,7 +20,6 @@ const { establishWebSocketConnection, closeWebSocketConnection, failWebsocketCon
19
20
  const { ByteParser } = require('./receiver')
20
21
  const { kEnumerableProperty } = require('../../core/util')
21
22
  const { getGlobalDispatcher } = require('../../global')
22
- const { types } = require('node:util')
23
23
  const { ErrorEvent, CloseEvent, createFastMessageEvent } = require('./events')
24
24
  const { SendQueue } = require('./sender')
25
25
  const { WebsocketFrameSend } = require('./frame')
@@ -257,7 +257,7 @@ class WebSocket extends EventTarget {
257
257
  this.#sendQueue.add(buffer, () => {
258
258
  this.#bufferedAmount -= buffer.byteLength
259
259
  }, sendHints.text)
260
- } else if (types.isArrayBuffer(data)) {
260
+ } else if (isArrayBuffer(data)) {
261
261
  // If the WebSocket connection is established, and the WebSocket
262
262
  // closing handshake has not yet started, then the user agent must
263
263
  // send a WebSocket Message comprised of data using a binary frame
@@ -482,11 +482,18 @@ class WebSocket extends EventTarget {
482
482
  fireEvent('open', this)
483
483
 
484
484
  if (channels.open.hasSubscribers) {
485
+ // Convert headers to a plain object for the event
486
+ const headers = response.headersList.entries
485
487
  channels.open.publish({
486
488
  address: response.socket.address(),
487
489
  protocol: this.#protocol,
488
490
  extensions: this.#extensions,
489
- websocket: this
491
+ websocket: this,
492
+ handshakeResponse: {
493
+ status: response.status,
494
+ statusText: response.statusText,
495
+ headers
496
+ }
490
497
  })
491
498
  }
492
499
  }
@@ -728,7 +735,7 @@ webidl.converters.WebSocketSendData = function (V) {
728
735
  return V
729
736
  }
730
737
 
731
- if (ArrayBuffer.isView(V) || types.isArrayBuffer(V)) {
738
+ if (ArrayBuffer.isView(V) || isArrayBuffer(V)) {
732
739
  return V
733
740
  }
734
741
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "undici",
3
- "version": "7.13.0",
3
+ "version": "7.15.0",
4
4
  "description": "An HTTP/1.1 client, written from scratch for Node.js",
5
5
  "homepage": "https://undici.nodejs.org",
6
6
  "bugs": {
@@ -69,7 +69,7 @@
69
69
  "lint:fix": "eslint --fix --cache",
70
70
  "test": "npm run test:javascript && cross-env NODE_V8_COVERAGE= npm run test:typescript",
71
71
  "test:javascript": "npm run test:javascript:no-jest && npm run test:jest",
72
- "test:javascript:no-jest": "npm run generate-pem && npm run test:unit && npm run test:node-fetch && npm run test:cache && npm run test:cache-interceptor && npm run test:interceptors && npm run test:fetch && npm run test:cookies && npm run test:eventsource && npm run test:wpt && npm run test:websocket && npm run test:node-test && npm run test:cache-tests",
72
+ "test:javascript:no-jest": "npm run generate-pem && npm run test:unit && npm run test:node-fetch && npm run test:cache && npm run test:cache-interceptor && npm run test:interceptors && npm run test:fetch && npm run test:cookies && npm run test:eventsource && npm run test:subresource-integrity && npm run test:wpt && npm run test:websocket && npm run test:node-test && npm run test:cache-tests",
73
73
  "test:javascript:without-intl": "npm run test:javascript:no-jest",
74
74
  "test:busboy": "borp -p \"test/busboy/*.js\"",
75
75
  "test:cache": "borp -p \"test/cache/*.js\"",
@@ -79,6 +79,7 @@
79
79
  "test:eventsource": "npm run build:node && borp --expose-gc -p \"test/eventsource/*.js\"",
80
80
  "test:fuzzing": "node test/fuzzing/fuzzing.test.js",
81
81
  "test:fetch": "npm run build:node && borp --timeout 180000 --expose-gc --concurrency 1 -p \"test/fetch/*.js\" && npm run test:webidl && npm run test:busboy",
82
+ "test:subresource-integrity": "borp -p \"test/subresource-integrity/*.js\"",
82
83
  "test:h2": "npm run test:h2:core && npm run test:h2:fetch",
83
84
  "test:h2:core": "borp -p \"test/+(http2|h2)*.js\"",
84
85
  "test:h2:fetch": "npm run build:node && borp -p \"test/fetch/http2*.js\"",
@@ -107,25 +108,25 @@
107
108
  "prepare": "husky && node ./scripts/platform-shell.js"
108
109
  },
109
110
  "devDependencies": {
110
- "@fastify/busboy": "3.1.1",
111
+ "@fastify/busboy": "3.2.0",
111
112
  "@matteo.collina/tspl": "^0.2.0",
113
+ "@metcoder95/https-pem": "^1.0.0",
112
114
  "@sinonjs/fake-timers": "^12.0.0",
113
115
  "@types/node": "^18.19.50",
114
116
  "abort-controller": "^3.0.0",
115
117
  "borp": "^0.20.0",
116
118
  "c8": "^10.0.0",
117
- "cross-env": "^7.0.3",
119
+ "cross-env": "^10.0.0",
118
120
  "dns-packet": "^5.4.0",
119
121
  "esbuild": "^0.25.2",
120
122
  "eslint": "^9.9.0",
121
123
  "fast-check": "^4.1.1",
122
- "https-pem": "^3.0.0",
123
124
  "husky": "^9.0.7",
124
- "jest": "^29.0.2",
125
+ "jest": "^30.0.5",
125
126
  "neostandard": "^0.12.0",
126
127
  "node-forge": "^1.3.1",
127
128
  "proxy": "^2.1.1",
128
- "tsd": "^0.32.0",
129
+ "tsd": "^0.33.0",
129
130
  "typescript": "^5.6.2",
130
131
  "ws": "^8.11.0"
131
132
  },
@@ -16,7 +16,6 @@ declare namespace DiagnosticsChannel {
16
16
  statusText: string;
17
17
  headers: Array<Buffer>;
18
18
  }
19
- type Error = unknown
20
19
  interface ConnectParams {
21
20
  host: URL['host'];
22
21
  hostname: URL['hostname'];
@@ -56,6 +56,11 @@ export declare const EventSource: {
56
56
  }
57
57
 
58
58
  interface EventSourceInit {
59
- withCredentials?: boolean,
59
+ withCredentials?: boolean
60
+ // @deprecated use `node.dispatcher` instead
60
61
  dispatcher?: Dispatcher
62
+ node?: {
63
+ dispatcher?: Dispatcher
64
+ reconnectionTime?: number
65
+ }
61
66
  }
package/types/index.d.ts CHANGED
@@ -34,7 +34,9 @@ export * from './content-type'
34
34
  export * from './cache'
35
35
  export { Interceptable } from './mock-interceptor'
36
36
 
37
- export { Dispatcher, BalancedPool, Pool, Client, buildConnector, errors, Agent, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, interceptors, MockClient, MockPool, MockAgent, SnapshotAgent, MockCallHistory, MockCallHistoryLog, mockErrors, ProxyAgent, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent, H2CClient }
37
+ declare function globalThisInstall (): void
38
+
39
+ export { Dispatcher, BalancedPool, Pool, Client, buildConnector, errors, Agent, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, interceptors, MockClient, MockPool, MockAgent, SnapshotAgent, MockCallHistory, MockCallHistoryLog, mockErrors, ProxyAgent, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent, H2CClient, globalThisInstall as install }
38
40
  export default Undici
39
41
 
40
42
  declare namespace Undici {
@@ -74,4 +76,5 @@ declare namespace Undici {
74
76
  MemoryCacheStore: typeof import('./cache-interceptor').default.MemoryCacheStore,
75
77
  SqliteCacheStore: typeof import('./cache-interceptor').default.SqliteCacheStore
76
78
  }
79
+ const install: typeof globalThisInstall
77
80
  }
@@ -9,6 +9,10 @@ declare namespace Interceptors {
9
9
  export type DumpInterceptorOpts = { maxSize?: number }
10
10
  export type RetryInterceptorOpts = RetryHandler.RetryOptions
11
11
  export type RedirectInterceptorOpts = { maxRedirections?: number }
12
+ export type DecompressInterceptorOpts = {
13
+ skipErrorResponses?: boolean
14
+ skipStatusCodes?: number[]
15
+ }
12
16
 
13
17
  export type ResponseErrorInterceptorOpts = { throwOnError: boolean }
14
18
  export type CacheInterceptorOpts = CacheHandler.CacheOptions
@@ -28,6 +32,7 @@ declare namespace Interceptors {
28
32
  export function dump (opts?: DumpInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
29
33
  export function retry (opts?: RetryInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
30
34
  export function redirect (opts?: RedirectInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
35
+ export function decompress (opts?: DecompressInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
31
36
  export function responseError (opts?: ResponseErrorInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
32
37
  export function dns (opts?: DNSInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
33
38
  export function cache (opts?: CacheInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
@@ -18,9 +18,11 @@ declare class SnapshotRecorder {
18
18
  }
19
19
 
20
20
  declare namespace SnapshotRecorder {
21
+ type SnapshotRecorderMode = 'record' | 'playback' | 'update'
22
+
21
23
  export interface Options {
22
24
  snapshotPath?: string
23
- mode?: 'record' | 'playback' | 'update'
25
+ mode?: SnapshotRecorderMode
24
26
  maxSnapshots?: number
25
27
  autoFlush?: boolean
26
28
  flushInterval?: number
@@ -77,7 +79,7 @@ declare class SnapshotAgent extends MockAgent {
77
79
  saveSnapshots (filePath?: string): Promise<void>
78
80
  loadSnapshots (filePath?: string): Promise<void>
79
81
  getRecorder (): SnapshotRecorder
80
- getMode (): 'record' | 'playback' | 'update'
82
+ getMode (): SnapshotRecorder.SnapshotRecorderMode
81
83
  clearSnapshots (): void
82
84
  resetCallCounts (): void
83
85
  deleteSnapshot (requestOpts: any): boolean
@@ -87,7 +89,7 @@ declare class SnapshotAgent extends MockAgent {
87
89
 
88
90
  declare namespace SnapshotAgent {
89
91
  export interface Options extends MockAgent.Options {
90
- mode?: 'record' | 'playback' | 'update'
92
+ mode?: SnapshotRecorder.SnapshotRecorderMode
91
93
  snapshotPath?: string
92
94
  maxSnapshots?: number
93
95
  autoFlush?: boolean
package/lib/api/util.js DELETED
@@ -1,95 +0,0 @@
1
- 'use strict'
2
-
3
- const assert = require('node:assert')
4
- const {
5
- ResponseStatusCodeError
6
- } = require('../core/errors')
7
-
8
- const { chunksDecode } = require('./readable')
9
- const CHUNK_LIMIT = 128 * 1024
10
-
11
- async function getResolveErrorBodyCallback ({ callback, body, contentType, statusCode, statusMessage, headers }) {
12
- assert(body)
13
-
14
- let chunks = []
15
- let length = 0
16
-
17
- try {
18
- for await (const chunk of body) {
19
- chunks.push(chunk)
20
- length += chunk.length
21
- if (length > CHUNK_LIMIT) {
22
- chunks = []
23
- length = 0
24
- break
25
- }
26
- }
27
- } catch {
28
- chunks = []
29
- length = 0
30
- // Do nothing....
31
- }
32
-
33
- const message = `Response status code ${statusCode}${statusMessage ? `: ${statusMessage}` : ''}`
34
-
35
- if (statusCode === 204 || !contentType || !length) {
36
- queueMicrotask(() => callback(new ResponseStatusCodeError(message, statusCode, headers)))
37
- return
38
- }
39
-
40
- const stackTraceLimit = Error.stackTraceLimit
41
- Error.stackTraceLimit = 0
42
- let payload
43
-
44
- try {
45
- if (isContentTypeApplicationJson(contentType)) {
46
- payload = JSON.parse(chunksDecode(chunks, length))
47
- } else if (isContentTypeText(contentType)) {
48
- payload = chunksDecode(chunks, length)
49
- }
50
- } catch {
51
- // process in a callback to avoid throwing in the microtask queue
52
- } finally {
53
- Error.stackTraceLimit = stackTraceLimit
54
- }
55
- queueMicrotask(() => callback(new ResponseStatusCodeError(message, statusCode, headers, payload)))
56
- }
57
-
58
- const isContentTypeApplicationJson = (contentType) => {
59
- return (
60
- contentType.length > 15 &&
61
- contentType[11] === '/' &&
62
- contentType[0] === 'a' &&
63
- contentType[1] === 'p' &&
64
- contentType[2] === 'p' &&
65
- contentType[3] === 'l' &&
66
- contentType[4] === 'i' &&
67
- contentType[5] === 'c' &&
68
- contentType[6] === 'a' &&
69
- contentType[7] === 't' &&
70
- contentType[8] === 'i' &&
71
- contentType[9] === 'o' &&
72
- contentType[10] === 'n' &&
73
- contentType[12] === 'j' &&
74
- contentType[13] === 's' &&
75
- contentType[14] === 'o' &&
76
- contentType[15] === 'n'
77
- )
78
- }
79
-
80
- const isContentTypeText = (contentType) => {
81
- return (
82
- contentType.length > 4 &&
83
- contentType[4] === '/' &&
84
- contentType[0] === 't' &&
85
- contentType[1] === 'e' &&
86
- contentType[2] === 'x' &&
87
- contentType[3] === 't'
88
- )
89
- }
90
-
91
- module.exports = {
92
- getResolveErrorBodyCallback,
93
- isContentTypeApplicationJson,
94
- isContentTypeText
95
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/llhttp/constants.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;AAIpC,QAAQ;AAEK,QAAA,KAAK,GAAY;IAC5B,EAAE,EAAE,CAAC;IACL,QAAQ,EAAE,CAAC;IACX,MAAM,EAAE,CAAC;IACT,WAAW,EAAE,EAAE;IACf,WAAW,EAAE,CAAC;IACd,yBAAyB,EAAE,CAAC;IAC5B,gBAAgB,EAAE,EAAE;IACpB,iBAAiB,EAAE,CAAC;IACpB,cAAc,EAAE,CAAC;IACjB,WAAW,EAAE,CAAC;IACd,gBAAgB,EAAE,CAAC;IACnB,eAAe,EAAE,CAAC;IAClB,oBAAoB,EA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