@mswjs/interceptors 0.41.9 → 0.42.1

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 (335) hide show
  1. package/README.md +274 -228
  2. package/lib/browser/{bufferUtils-BiiO6HZv.mjs → buffer-utils-DJj7YzLG.js} +3 -3
  3. package/lib/browser/buffer-utils-DJj7YzLG.js.map +1 -0
  4. package/lib/browser/create-request-id-Bk5YX1AM.js +720 -0
  5. package/lib/browser/create-request-id-Bk5YX1AM.js.map +1 -0
  6. package/lib/browser/{getRawRequest-B1BqgWG6.mjs → fetch-utils-CUOrwEQf.js} +123 -52
  7. package/lib/browser/fetch-utils-CUOrwEQf.js.map +1 -0
  8. package/lib/browser/handle-request-CqVvBhcw.js +167 -0
  9. package/lib/browser/handle-request-CqVvBhcw.js.map +1 -0
  10. package/lib/{node/hasConfigurableGlobal-BiTmog1u.mjs → browser/has-configurable-global-Cew-dYqk.js} +5 -7
  11. package/lib/browser/has-configurable-global-Cew-dYqk.js.map +1 -0
  12. package/lib/browser/http-CB9rQ7i_.d.ts +105 -0
  13. package/lib/browser/{index.d.cts → index.d.ts} +33 -38
  14. package/lib/browser/index.js +130 -0
  15. package/lib/browser/index.js.map +1 -0
  16. package/lib/browser/interceptor-dtJZ_9QT.d.ts +50 -0
  17. package/lib/browser/interceptors/WebSocket/index.d.ts +2 -0
  18. package/lib/browser/interceptors/WebSocket/{index.mjs → index.js} +39 -30
  19. package/lib/browser/interceptors/WebSocket/index.js.map +1 -0
  20. package/lib/browser/interceptors/XMLHttpRequest/web.d.ts +11 -0
  21. package/lib/browser/interceptors/XMLHttpRequest/web.js +2 -0
  22. package/lib/browser/interceptors/fetch/web.d.ts +14 -0
  23. package/lib/browser/interceptors/fetch/web.js +2 -0
  24. package/lib/browser/presets/browser.d.ts +11 -0
  25. package/lib/browser/presets/browser.js +12 -0
  26. package/lib/browser/presets/browser.js.map +1 -0
  27. package/lib/browser/{resolveWebSocketUrl-C83-x9iE.mjs → resolve-web-socket-url-CSvNPLGi.js} +3 -3
  28. package/lib/browser/resolve-web-socket-url-CSvNPLGi.js.map +1 -0
  29. package/lib/browser/{XMLHttpRequest-DrZAf3w6.mjs → web-BcKSQghf.js} +327 -255
  30. package/lib/browser/web-BcKSQghf.js.map +1 -0
  31. package/lib/browser/web-CdcYFjgm.js +248 -0
  32. package/lib/browser/web-CdcYFjgm.js.map +1 -0
  33. package/lib/browser/{interceptors/WebSocket/index.d.cts → websocket-CC0nB0md.d.ts} +41 -33
  34. package/lib/node/batch-interceptor-ByEZVih3.js +119 -0
  35. package/lib/node/batch-interceptor-ByEZVih3.js.map +1 -0
  36. package/lib/node/batch-interceptor-CPjFK2td.d.ts +28 -0
  37. package/lib/node/buffer-utils-BvPY1Tc-.js +187 -0
  38. package/lib/node/buffer-utils-BvPY1Tc-.js.map +1 -0
  39. package/lib/node/fetch-utils-Dw1PsmtX.js +568 -0
  40. package/lib/node/fetch-utils-Dw1PsmtX.js.map +1 -0
  41. package/lib/node/has-configurable-global-CJCh_g1I.js +22 -0
  42. package/lib/node/has-configurable-global-CJCh_g1I.js.map +1 -0
  43. package/lib/node/http-CB9rQ7i_.d.ts +105 -0
  44. package/lib/{browser/interceptors/WebSocket/index.d.mts → node/index.d.ts} +120 -60
  45. package/lib/node/{index.mjs → index.js} +8 -11
  46. package/lib/node/index.js.map +1 -0
  47. package/lib/node/interceptor-dtJZ_9QT.d.ts +50 -0
  48. package/lib/node/interceptors/ClientRequest/index.d.ts +14 -0
  49. package/lib/node/interceptors/ClientRequest/index.js +67 -0
  50. package/lib/node/interceptors/ClientRequest/index.js.map +1 -0
  51. package/lib/node/interceptors/XMLHttpRequest/node.d.ts +12 -0
  52. package/lib/node/interceptors/XMLHttpRequest/node.js +74 -0
  53. package/lib/node/interceptors/XMLHttpRequest/node.js.map +1 -0
  54. package/lib/node/interceptors/fetch/node.d.ts +18 -0
  55. package/lib/node/interceptors/fetch/node.js +83 -0
  56. package/lib/node/interceptors/fetch/node.js.map +1 -0
  57. package/lib/node/interceptors/http/index.d.ts +14 -0
  58. package/lib/node/interceptors/http/index.js +32 -0
  59. package/lib/node/interceptors/http/index.js.map +1 -0
  60. package/lib/node/interceptors/net/index.d.ts +203 -0
  61. package/lib/node/interceptors/net/index.js +2 -0
  62. package/lib/node/llhttp/constants.cjs +485 -0
  63. package/lib/node/llhttp/constants.d.cts +957 -0
  64. package/lib/node/llhttp/llhttp.wasm +0 -0
  65. package/lib/node/net-DtMnyEeg.js +1388 -0
  66. package/lib/node/net-DtMnyEeg.js.map +1 -0
  67. package/lib/node/presets/node.d.ts +12 -0
  68. package/lib/node/presets/node.js +17 -0
  69. package/lib/node/presets/node.js.map +1 -0
  70. package/lib/node/{RemoteHttpInterceptor.d.cts → remote-http-interceptor.d.ts} +12 -11
  71. package/lib/node/{RemoteHttpInterceptor.mjs → remote-http-interceptor.js} +38 -33
  72. package/lib/node/remote-http-interceptor.js.map +1 -0
  73. package/lib/node/source-lP0yyEtA.js +1990 -0
  74. package/lib/node/source-lP0yyEtA.js.map +1 -0
  75. package/package.json +79 -118
  76. package/src/batch-interceptor.test.ts +475 -0
  77. package/src/batch-interceptor.ts +244 -0
  78. package/src/{createRequestId.test.ts → create-request-id.test.ts} +1 -2
  79. package/src/disposable.ts +13 -0
  80. package/src/events/http.ts +92 -0
  81. package/src/events/websocket.ts +47 -0
  82. package/src/glossary.ts +1 -27
  83. package/src/index.ts +18 -10
  84. package/src/interceptor.test.ts +279 -0
  85. package/src/interceptor.ts +139 -0
  86. package/src/interceptors/ClientRequest/index.test.ts +21 -39
  87. package/src/interceptors/ClientRequest/index.ts +64 -179
  88. package/src/interceptors/ClientRequest/utils/{recordRawHeaders.test.ts → record-raw-headers.test.ts} +1 -2
  89. package/src/interceptors/ClientRequest/utils/{recordRawHeaders.ts → record-raw-headers.ts} +29 -2
  90. package/src/interceptors/WebSocket/index.ts +33 -50
  91. package/src/interceptors/WebSocket/utils/{bindEvent.test.ts → bind-event.test.ts} +1 -2
  92. package/src/interceptors/WebSocket/utils/events.test.ts +0 -1
  93. package/src/interceptors/WebSocket/{WebSocketClassTransport.ts → web-socket-class-transport.ts} +3 -3
  94. package/src/interceptors/WebSocket/{WebSocketClientConnection.ts → web-socket-client-connection.ts} +4 -4
  95. package/src/interceptors/WebSocket/{WebSocketOverride.ts → web-socket-override.ts} +6 -7
  96. package/src/interceptors/WebSocket/{WebSocketServerConnection.ts → web-socket-server-connection.ts} +4 -4
  97. package/src/interceptors/WebSocket/{WebSocketTransport.ts → web-socket-transport.ts} +1 -1
  98. package/src/interceptors/XMLHttpRequest/node.ts +104 -0
  99. package/src/interceptors/XMLHttpRequest/polyfills/{ProgressEventPolyfill.ts → progress-event-polyfill.ts} +1 -1
  100. package/src/interceptors/XMLHttpRequest/utils/{concateArrayBuffer.test.ts → concat-array-buffer.test.ts} +1 -2
  101. package/src/interceptors/XMLHttpRequest/utils/{concatArrayBuffer.ts → concat-array-buffer.ts} +1 -1
  102. package/src/interceptors/XMLHttpRequest/utils/{createEvent.test.ts → create-event.test.ts} +3 -4
  103. package/src/interceptors/XMLHttpRequest/utils/{createEvent.ts → create-event.ts} +2 -2
  104. package/src/interceptors/XMLHttpRequest/utils/{createResponse.ts → create-response.ts} +1 -1
  105. package/src/interceptors/XMLHttpRequest/utils/{getBodyByteLength.test.ts → get-body-byte-length.test.ts} +1 -2
  106. package/src/interceptors/XMLHttpRequest/web.ts +34 -0
  107. package/src/interceptors/XMLHttpRequest/{XMLHttpRequestController.ts → xml-http-request-controller.ts} +363 -204
  108. package/src/interceptors/XMLHttpRequest/{XMLHttpRequestProxy.ts → xml-http-request-proxy.ts} +28 -25
  109. package/src/interceptors/fetch/node.ts +103 -0
  110. package/src/interceptors/fetch/utils/{followRedirect.ts → follow-redirect.ts} +1 -1
  111. package/src/interceptors/fetch/web.ts +217 -0
  112. package/src/interceptors/http/forward-events.test.ts +86 -0
  113. package/src/interceptors/http/forward-events.ts +139 -0
  114. package/src/interceptors/http/http-parser/index.ts +310 -0
  115. package/src/interceptors/http/http-parser/llhttp/constants.cjs +485 -0
  116. package/src/interceptors/http/http-parser/llhttp/constants.d.cts +957 -0
  117. package/src/interceptors/http/http-parser/llhttp/llhttp.wasm +0 -0
  118. package/src/interceptors/http/http-parser.ts +138 -0
  119. package/src/interceptors/http/index.ts +34 -0
  120. package/src/interceptors/http/source.ts +688 -0
  121. package/src/interceptors/net/index.ts +368 -0
  122. package/src/interceptors/net/socket-controller.ts +1476 -0
  123. package/src/interceptors/net/utils/address-info.ts +54 -0
  124. package/src/interceptors/net/utils/connection-options-to-url.ts +56 -0
  125. package/src/interceptors/net/utils/flush-writes.ts +57 -0
  126. package/src/interceptors/net/utils/get-tls-connect-options.ts +23 -0
  127. package/src/interceptors/net/utils/normalize-net-connect-args.test.ts +233 -0
  128. package/src/interceptors/net/utils/normalize-net-connect-args.ts +121 -0
  129. package/src/interceptors/net/utils/normalize-tls-connect-args.ts +50 -0
  130. package/src/presets/browser.ts +4 -4
  131. package/src/presets/node.ts +4 -4
  132. package/src/{RemoteHttpInterceptor.ts → remote-http-interceptor.ts} +55 -42
  133. package/src/request-context.ts +40 -0
  134. package/src/{RequestController.test.ts → request-controller.test.ts} +37 -3
  135. package/src/{RequestController.ts → request-controller.ts} +33 -11
  136. package/src/utils/{bufferUtils.test.ts → buffer-utils.test.ts} +1 -2
  137. package/src/utils/buffer-utils.ts +37 -0
  138. package/src/utils/{cloneObject.test.ts → clone-object.test.ts} +1 -2
  139. package/src/utils/{cloneObject.ts → clone-object.ts} +8 -8
  140. package/src/utils/{createProxy.test.ts → create-proxy.test.ts} +6 -4
  141. package/src/utils/{createProxy.ts → create-proxy.ts} +1 -1
  142. package/src/utils/{fetchUtils.test.ts → fetch-utils.test.ts} +1 -1
  143. package/src/utils/{fetchUtils.ts → fetch-utils.ts} +28 -3
  144. package/src/utils/{findPropertySource.test.ts → find-property-source.test.ts} +1 -2
  145. package/src/utils/{getCleanUrl.test.ts → get-clean-url.test.ts} +1 -2
  146. package/src/utils/{getUrlByRequestOptions.test.ts → get-url-by-request-options.test.ts} +4 -8
  147. package/src/utils/{getUrlByRequestOptions.ts → get-url-by-request-options.ts} +16 -16
  148. package/src/utils/{getValueBySymbol.test.ts → get-value-by-symbol.test.ts} +1 -2
  149. package/src/utils/{handleRequest.ts → handle-request.ts} +61 -41
  150. package/src/utils/{hasConfigurableGlobal.test.ts → has-configurable-global.test.ts} +1 -2
  151. package/src/utils/{hasConfigurableGlobal.ts → has-configurable-global.ts} +2 -4
  152. package/src/utils/{isObject.test.ts → is-object.test.ts} +1 -2
  153. package/src/utils/logger.test.ts +154 -0
  154. package/src/utils/logger.ts +154 -0
  155. package/src/utils/{parseJson.test.ts → parse-json.test.ts} +1 -2
  156. package/src/utils/{patchesRegistry.test.ts → patches-registry.test.ts} +1 -1
  157. package/src/utils/{patchesRegistry.ts → patches-registry.ts} +1 -1
  158. package/src/utils/{responseUtils.ts → response-utils.ts} +25 -2
  159. package/ClientRequest/package.json +0 -11
  160. package/RemoteHttpInterceptor/package.json +0 -11
  161. package/WebSocket/package.json +0 -12
  162. package/XMLHttpRequest/package.json +0 -12
  163. package/fetch/package.json +0 -12
  164. package/lib/browser/Interceptor-Deczogc8.d.cts +0 -65
  165. package/lib/browser/Interceptor-gqKgs-aF.d.mts +0 -65
  166. package/lib/browser/XMLHttpRequest-DrZAf3w6.mjs.map +0 -1
  167. package/lib/browser/XMLHttpRequest-gXuzzX1g.cjs +0 -751
  168. package/lib/browser/XMLHttpRequest-gXuzzX1g.cjs.map +0 -1
  169. package/lib/browser/bufferUtils-BiiO6HZv.mjs.map +0 -1
  170. package/lib/browser/bufferUtils-Uc0eRItL.cjs +0 -38
  171. package/lib/browser/bufferUtils-Uc0eRItL.cjs.map +0 -1
  172. package/lib/browser/createRequestId-DOf8Ktjs.cjs +0 -205
  173. package/lib/browser/createRequestId-DOf8Ktjs.cjs.map +0 -1
  174. package/lib/browser/createRequestId-DYCsFHOi.mjs +0 -170
  175. package/lib/browser/createRequestId-DYCsFHOi.mjs.map +0 -1
  176. package/lib/browser/fetch-5IMPqr9e.mjs +0 -236
  177. package/lib/browser/fetch-5IMPqr9e.mjs.map +0 -1
  178. package/lib/browser/fetch-Bt9rMY9c.cjs +0 -241
  179. package/lib/browser/fetch-Bt9rMY9c.cjs.map +0 -1
  180. package/lib/browser/getRawRequest-B1BqgWG6.mjs.map +0 -1
  181. package/lib/browser/getRawRequest-DdfaiPVH.cjs +0 -376
  182. package/lib/browser/getRawRequest-DdfaiPVH.cjs.map +0 -1
  183. package/lib/browser/glossary-1lhZx6Aw.d.cts +0 -69
  184. package/lib/browser/glossary-nkHWcwvY.d.mts +0 -69
  185. package/lib/browser/handleRequest-CJim54xG.cjs +0 -191
  186. package/lib/browser/handleRequest-CJim54xG.cjs.map +0 -1
  187. package/lib/browser/handleRequest-CPPgsG7s.mjs +0 -180
  188. package/lib/browser/handleRequest-CPPgsG7s.mjs.map +0 -1
  189. package/lib/browser/hasConfigurableGlobal-C8zq1MCg.mjs +0 -109
  190. package/lib/browser/hasConfigurableGlobal-C8zq1MCg.mjs.map +0 -1
  191. package/lib/browser/hasConfigurableGlobal-CS7adEvV.cjs +0 -126
  192. package/lib/browser/hasConfigurableGlobal-CS7adEvV.cjs.map +0 -1
  193. package/lib/browser/index.cjs +0 -70
  194. package/lib/browser/index.cjs.map +0 -1
  195. package/lib/browser/index.d.mts +0 -125
  196. package/lib/browser/index.mjs +0 -56
  197. package/lib/browser/index.mjs.map +0 -1
  198. package/lib/browser/interceptors/WebSocket/index.cjs +0 -618
  199. package/lib/browser/interceptors/WebSocket/index.cjs.map +0 -1
  200. package/lib/browser/interceptors/WebSocket/index.mjs.map +0 -1
  201. package/lib/browser/interceptors/XMLHttpRequest/index.cjs +0 -8
  202. package/lib/browser/interceptors/XMLHttpRequest/index.d.cts +0 -15
  203. package/lib/browser/interceptors/XMLHttpRequest/index.d.mts +0 -15
  204. package/lib/browser/interceptors/XMLHttpRequest/index.mjs +0 -8
  205. package/lib/browser/interceptors/fetch/index.cjs +0 -7
  206. package/lib/browser/interceptors/fetch/index.d.cts +0 -13
  207. package/lib/browser/interceptors/fetch/index.d.mts +0 -13
  208. package/lib/browser/interceptors/fetch/index.mjs +0 -7
  209. package/lib/browser/presets/browser.cjs +0 -18
  210. package/lib/browser/presets/browser.cjs.map +0 -1
  211. package/lib/browser/presets/browser.d.cts +0 -12
  212. package/lib/browser/presets/browser.d.mts +0 -14
  213. package/lib/browser/presets/browser.mjs +0 -18
  214. package/lib/browser/presets/browser.mjs.map +0 -1
  215. package/lib/browser/resolveWebSocketUrl-6K6EgqsA.cjs +0 -31
  216. package/lib/browser/resolveWebSocketUrl-6K6EgqsA.cjs.map +0 -1
  217. package/lib/browser/resolveWebSocketUrl-C83-x9iE.mjs.map +0 -1
  218. package/lib/node/BatchInterceptor-BGhH8z1z.cjs +0 -49
  219. package/lib/node/BatchInterceptor-BGhH8z1z.cjs.map +0 -1
  220. package/lib/node/BatchInterceptor-C4-RX5rg.mjs +0 -44
  221. package/lib/node/BatchInterceptor-C4-RX5rg.mjs.map +0 -1
  222. package/lib/node/BatchInterceptor-KKF8Q47I.d.cts +0 -26
  223. package/lib/node/BatchInterceptor-rSr-NH_H.d.mts +0 -26
  224. package/lib/node/ClientRequest-2loAH7xM.cjs +0 -1058
  225. package/lib/node/ClientRequest-2loAH7xM.cjs.map +0 -1
  226. package/lib/node/ClientRequest-DGhBX21V.mjs +0 -1049
  227. package/lib/node/ClientRequest-DGhBX21V.mjs.map +0 -1
  228. package/lib/node/Interceptor-BsZ21ue0.d.cts +0 -132
  229. package/lib/node/Interceptor-soD-WpQO.d.mts +0 -132
  230. package/lib/node/RemoteHttpInterceptor.cjs +0 -155
  231. package/lib/node/RemoteHttpInterceptor.cjs.map +0 -1
  232. package/lib/node/RemoteHttpInterceptor.d.mts +0 -39
  233. package/lib/node/RemoteHttpInterceptor.mjs.map +0 -1
  234. package/lib/node/XMLHttpRequest-BtDNZipW.cjs +0 -752
  235. package/lib/node/XMLHttpRequest-BtDNZipW.cjs.map +0 -1
  236. package/lib/node/XMLHttpRequest-Dw6Wm-UU.mjs +0 -746
  237. package/lib/node/XMLHttpRequest-Dw6Wm-UU.mjs.map +0 -1
  238. package/lib/node/bufferUtils-DxPxwff_.mjs +0 -20
  239. package/lib/node/bufferUtils-DxPxwff_.mjs.map +0 -1
  240. package/lib/node/bufferUtils-S5_-2eN4.cjs +0 -38
  241. package/lib/node/bufferUtils-S5_-2eN4.cjs.map +0 -1
  242. package/lib/node/chunk-CbDLau6x.cjs +0 -34
  243. package/lib/node/fetch-CaC3rGEu.mjs +0 -252
  244. package/lib/node/fetch-CaC3rGEu.mjs.map +0 -1
  245. package/lib/node/fetch-D2ClLNN-.cjs +0 -259
  246. package/lib/node/fetch-D2ClLNN-.cjs.map +0 -1
  247. package/lib/node/fetchUtils-BKJ1XmiO.mjs +0 -480
  248. package/lib/node/fetchUtils-BKJ1XmiO.mjs.map +0 -1
  249. package/lib/node/fetchUtils-umV5xXBy.cjs +0 -546
  250. package/lib/node/fetchUtils-umV5xXBy.cjs.map +0 -1
  251. package/lib/node/getRawRequest-B6znU6il.cjs +0 -36
  252. package/lib/node/getRawRequest-B6znU6il.cjs.map +0 -1
  253. package/lib/node/getRawRequest-C2-1urzA.mjs +0 -24
  254. package/lib/node/getRawRequest-C2-1urzA.mjs.map +0 -1
  255. package/lib/node/handleRequest-C-cKYjIh.cjs +0 -222
  256. package/lib/node/handleRequest-C-cKYjIh.cjs.map +0 -1
  257. package/lib/node/handleRequest-FIQv5pwH.mjs +0 -192
  258. package/lib/node/handleRequest-FIQv5pwH.mjs.map +0 -1
  259. package/lib/node/hasConfigurableGlobal-BiTmog1u.mjs.map +0 -1
  260. package/lib/node/hasConfigurableGlobal-MjY06_Ok.cjs +0 -108
  261. package/lib/node/hasConfigurableGlobal-MjY06_Ok.cjs.map +0 -1
  262. package/lib/node/index-BJ5E5aW-.d.cts +0 -113
  263. package/lib/node/index-DfoF45ih.d.mts +0 -113
  264. package/lib/node/index.cjs +0 -53
  265. package/lib/node/index.cjs.map +0 -1
  266. package/lib/node/index.d.cts +0 -104
  267. package/lib/node/index.d.mts +0 -104
  268. package/lib/node/index.mjs.map +0 -1
  269. package/lib/node/interceptors/ClientRequest/index.cjs +0 -6
  270. package/lib/node/interceptors/ClientRequest/index.d.cts +0 -2
  271. package/lib/node/interceptors/ClientRequest/index.d.mts +0 -3
  272. package/lib/node/interceptors/ClientRequest/index.mjs +0 -6
  273. package/lib/node/interceptors/XMLHttpRequest/index.cjs +0 -7
  274. package/lib/node/interceptors/XMLHttpRequest/index.d.cts +0 -14
  275. package/lib/node/interceptors/XMLHttpRequest/index.d.mts +0 -14
  276. package/lib/node/interceptors/XMLHttpRequest/index.mjs +0 -7
  277. package/lib/node/interceptors/fetch/index.cjs +0 -6
  278. package/lib/node/interceptors/fetch/index.d.cts +0 -12
  279. package/lib/node/interceptors/fetch/index.d.mts +0 -12
  280. package/lib/node/interceptors/fetch/index.mjs +0 -6
  281. package/lib/node/node-DIKcnzhK.cjs +0 -39
  282. package/lib/node/node-DIKcnzhK.cjs.map +0 -1
  283. package/lib/node/node-lsdNwZEW.mjs +0 -27
  284. package/lib/node/node-lsdNwZEW.mjs.map +0 -1
  285. package/lib/node/presets/node.cjs +0 -23
  286. package/lib/node/presets/node.cjs.map +0 -1
  287. package/lib/node/presets/node.d.cts +0 -13
  288. package/lib/node/presets/node.d.mts +0 -15
  289. package/lib/node/presets/node.mjs +0 -23
  290. package/lib/node/presets/node.mjs.map +0 -1
  291. package/lib/node/utils/node/index.cjs +0 -4
  292. package/lib/node/utils/node/index.d.cts +0 -16
  293. package/lib/node/utils/node/index.d.mts +0 -16
  294. package/lib/node/utils/node/index.mjs +0 -3
  295. package/presets/browser/package.json +0 -5
  296. package/presets/node/package.json +0 -11
  297. package/src/BatchInterceptor.test.ts +0 -255
  298. package/src/BatchInterceptor.ts +0 -96
  299. package/src/Interceptor.test.ts +0 -205
  300. package/src/Interceptor.ts +0 -249
  301. package/src/getRawRequest.ts +0 -21
  302. package/src/interceptors/ClientRequest/MockHttpSocket.ts +0 -724
  303. package/src/interceptors/ClientRequest/agents.ts +0 -110
  304. package/src/interceptors/ClientRequest/utils/getIncomingMessageBody.test.ts +0 -54
  305. package/src/interceptors/ClientRequest/utils/getIncomingMessageBody.ts +0 -45
  306. package/src/interceptors/ClientRequest/utils/normalizeClientRequestArgs.test.ts +0 -427
  307. package/src/interceptors/ClientRequest/utils/normalizeClientRequestArgs.ts +0 -268
  308. package/src/interceptors/ClientRequest/utils/parserUtils.ts +0 -48
  309. package/src/interceptors/Socket/MockSocket.test.ts +0 -264
  310. package/src/interceptors/Socket/MockSocket.ts +0 -58
  311. package/src/interceptors/Socket/utils/baseUrlFromConnectionOptions.ts +0 -26
  312. package/src/interceptors/Socket/utils/normalizeSocketWriteArgs.test.ts +0 -52
  313. package/src/interceptors/Socket/utils/normalizeSocketWriteArgs.ts +0 -33
  314. package/src/interceptors/XMLHttpRequest/index.ts +0 -40
  315. package/src/interceptors/fetch/index.ts +0 -203
  316. package/src/utils/bufferUtils.ts +0 -22
  317. package/src/utils/canParseUrl.ts +0 -13
  318. package/src/utils/emitAsync.ts +0 -25
  319. package/src/utils/nextTick.ts +0 -11
  320. package/src/utils/node/index.ts +0 -39
  321. /package/src/{createRequestId.ts → create-request-id.ts} +0 -0
  322. /package/src/{InterceptorError.ts → interceptor-error.ts} +0 -0
  323. /package/src/interceptors/WebSocket/utils/{bindEvent.ts → bind-event.ts} +0 -0
  324. /package/src/interceptors/XMLHttpRequest/polyfills/{EventPolyfill.ts → event-polyfill.ts} +0 -0
  325. /package/src/interceptors/XMLHttpRequest/utils/{getBodyByteLength.ts → get-body-byte-length.ts} +0 -0
  326. /package/src/interceptors/XMLHttpRequest/utils/{isDomParserSupportedType.ts → is-dom-parser-supported-type.ts} +0 -0
  327. /package/src/interceptors/fetch/utils/{createNetworkError.ts → create-network-error.ts} +0 -0
  328. /package/src/utils/{findPropertySource.ts → find-property-source.ts} +0 -0
  329. /package/src/utils/{getCleanUrl.ts → get-clean-url.ts} +0 -0
  330. /package/src/utils/{getValueBySymbol.ts → get-value-by-symbol.ts} +0 -0
  331. /package/src/utils/{isNodeLikeError.ts → is-node-like-error.ts} +0 -0
  332. /package/src/utils/{isObject.ts → is-object.ts} +0 -0
  333. /package/src/utils/{isPropertyAccessible.ts → is-property-accessible.ts} +0 -0
  334. /package/src/utils/{parseJson.ts → parse-json.ts} +0 -0
  335. /package/src/utils/{resolveWebSocketUrl.ts → resolve-web-socket-url.ts} +0 -0
@@ -0,0 +1,54 @@
1
+ import net from 'node:net'
2
+ import { NetworkConnectionOptions } from './normalize-net-connect-args'
3
+
4
+ export function getAddressInfoByConnectionOptions(
5
+ options?: NetworkConnectionOptions
6
+ ): ReturnType<net.Socket['address']> {
7
+ if (options == null) {
8
+ return {}
9
+ }
10
+
11
+ const isIPv6 = options.family === 6 || net.isIPv6(options.host || '')
12
+
13
+ return {
14
+ address: isIPv6 ? '::1' : '127.0.0.1',
15
+ /**
16
+ * @note Coerce the port to a number. Connection options may
17
+ * describe it as a string (e.g. when created from a URL), while
18
+ * the address info always reports a numeric port.
19
+ */
20
+ port: Number(options.port) || (options.protocol === 'https:' ? 443 : 80),
21
+ family: isIPv6 ? 'IPv6' : 'IPv4',
22
+ }
23
+ }
24
+
25
+ /**
26
+ * Get the local address info for the given connection options.
27
+ * This describes the client-side end of the connection: the socket
28
+ * is bound to the loopback interface and an ephemeral port, the same
29
+ * way the operating system binds an outgoing connection.
30
+ */
31
+ export function getLocalAddressInfoByConnectionOptions(
32
+ options?: NetworkConnectionOptions
33
+ ): ReturnType<net.Socket['address']> {
34
+ if (options == null) {
35
+ return {}
36
+ }
37
+
38
+ const isIPv6 = options.family === 6 || net.isIPv6(options.host || '')
39
+
40
+ return {
41
+ address: options.localAddress || (isIPv6 ? '::1' : '127.0.0.1'),
42
+ port: options.localPort || getEphemeralPort(),
43
+ family: isIPv6 ? 'IPv6' : 'IPv4',
44
+ }
45
+ }
46
+
47
+ /**
48
+ * Get a random port from the ephemeral range (IANA: 49152-65535),
49
+ * the range the operating system draws from when binding an
50
+ * outgoing connection.
51
+ */
52
+ function getEphemeralPort(): number {
53
+ return 49152 + Math.floor(Math.random() * (65535 - 49152 + 1))
54
+ }
@@ -0,0 +1,56 @@
1
+ import net from 'node:net'
2
+ import tls from 'node:tls'
3
+ import { NetworkConnectionOptions } from './normalize-net-connect-args'
4
+
5
+ /**
6
+ * Creates a `URL` instance out of the `net.connect()` options.
7
+ * @note This implies that the passed connection is an HTTP connection.
8
+ */
9
+ export function connectionOptionsToUrl(
10
+ options: NetworkConnectionOptions,
11
+ socket: net.Socket
12
+ ): URL {
13
+ const isIPv6 = net.isIPv6(options.host || '')
14
+ const protocol =
15
+ socket instanceof tls.TLSSocket
16
+ ? 'https:'
17
+ : getProtocolByConnectionOptions(options)
18
+ const host = options.host || 'localhost'
19
+
20
+ const url = new URL(`${protocol}//${isIPv6 ? `[${host}]` : host}`)
21
+
22
+ if (options.path) {
23
+ url.pathname = options.path
24
+ }
25
+
26
+ if (options.port) {
27
+ url.port = options.port.toString()
28
+ }
29
+
30
+ if (options.auth) {
31
+ const [username, password] = options.auth.split(':')
32
+ /**
33
+ * Authentication options are provided as plain values.
34
+ * Encode them to form a valid URL.
35
+ * @see https://github.com/nodejs/node/blob/f3adc11e37b8bfaaa026ea85c1cf22e3a0e29ae9/lib/internal/url.js#L1452
36
+ */
37
+ url.username = encodeURIComponent(username)
38
+ url.password = encodeURIComponent(password)
39
+ }
40
+
41
+ return url
42
+ }
43
+
44
+ function getProtocolByConnectionOptions(
45
+ options: NetworkConnectionOptions
46
+ ): 'https:' | 'http:' | (string & {}) {
47
+ if (options.protocol) {
48
+ return options.protocol
49
+ }
50
+
51
+ if (options.port === 443) {
52
+ return 'https:'
53
+ }
54
+
55
+ return 'http:'
56
+ }
@@ -0,0 +1,57 @@
1
+ import net from 'node:net'
2
+
3
+ /**
4
+ * Write the given pending data to the socket using its public
5
+ * "write()" method. Unlike direct "_writeGeneric()" calls, public
6
+ * writes go through the "Writable" queue that only dispatches the
7
+ * next write once the previous one completes. TLS sockets rely on
8
+ * that serialization: their "TLSWrap" handle supports a single
9
+ * write in flight and crashes the process with a native
10
+ * "Assertion failed: !current_write_" abort when writes overlap
11
+ * (e.g. multiple direct "_writeGeneric()" calls issued on a
12
+ * connecting socket replay back-to-back on "connect").
13
+ */
14
+ export function writePendingData(
15
+ socket: net.Socket,
16
+ data: NonNullable<net.Socket['_pendingData']>,
17
+ encoding: BufferEncoding,
18
+ callback?: (error?: Error | null) => void
19
+ ): void {
20
+ if (Array.isArray(data)) {
21
+ for (let index = 0; index < data.length; index++) {
22
+ const entry = data[index]
23
+ const isLastEntry = index === data.length - 1
24
+
25
+ /**
26
+ * @note Per-entry callbacks are intentionally ignored, the same
27
+ * way "writevGeneric()" only honors the batch-level callback.
28
+ */
29
+ if (isLastEntry) {
30
+ socket.write(entry.chunk, entry.encoding, callback)
31
+ } else {
32
+ socket.write(entry.chunk, entry.encoding)
33
+ }
34
+ }
35
+
36
+ return
37
+ }
38
+
39
+ socket.write(data, encoding, callback)
40
+ }
41
+
42
+ export function unwrapPendingData(
43
+ data: NonNullable<net.Socket['_pendingData']>,
44
+ callback: (
45
+ chunk: string | Buffer,
46
+ encoding?: BufferEncoding,
47
+ callback?: (error?: Error | null) => void
48
+ ) => void
49
+ ) {
50
+ if (Array.isArray(data)) {
51
+ for (const entry of data) {
52
+ callback(entry.chunk, entry.encoding, entry.callback)
53
+ }
54
+ } else {
55
+ callback(data)
56
+ }
57
+ }
@@ -0,0 +1,23 @@
1
+ import type tls from 'node:tls'
2
+
3
+ /**
4
+ * Returns the original options the given TLS socket was created with.
5
+ * The original `tls.connect()` stores them on the socket instance
6
+ * under an internal symbol before connecting its transport.
7
+ * @see https://github.com/nodejs/node/blob/3178a762d6a2b1a37b74f02266eea0f3d86603f1/lib/_tls_wrap.js#L1690
8
+ */
9
+ export function getTlsConnectOptions(
10
+ socket: tls.TLSSocket
11
+ ): tls.ConnectionOptions | undefined {
12
+ const kConnectOptions = Object.getOwnPropertySymbols(socket).find(
13
+ (symbol) => {
14
+ return symbol.description === 'connect-options'
15
+ }
16
+ )
17
+
18
+ if (kConnectOptions == null) {
19
+ return undefined
20
+ }
21
+
22
+ return Reflect.get(socket, kConnectOptions)
23
+ }
@@ -0,0 +1,233 @@
1
+ import {
2
+ normalizeNetConnectArgs,
3
+ type NetConnectArgs,
4
+ } from './normalize-net-connect-args'
5
+
6
+ it('normalizes an empty arguments list', () => {
7
+ expect(normalizeNetConnectArgs([])).toEqual([{ path: '' }, null])
8
+ })
9
+
10
+ it('normalizes "(port)"', () => {
11
+ expect(normalizeNetConnectArgs([8080])).toEqual([
12
+ {
13
+ port: 8080,
14
+ path: '',
15
+ host: undefined,
16
+ },
17
+ null,
18
+ ])
19
+ })
20
+
21
+ it('normalizes "(port, callback)"', () => {
22
+ const callback = () => {}
23
+
24
+ expect(normalizeNetConnectArgs([8080, callback])).toEqual([
25
+ {
26
+ port: 8080,
27
+ path: '',
28
+ host: undefined,
29
+ },
30
+ callback,
31
+ ])
32
+ })
33
+
34
+ it('normalizes "(port, host)"', () => {
35
+ expect(normalizeNetConnectArgs([8080, 'example.com'])).toEqual([
36
+ {
37
+ port: 8080,
38
+ path: '',
39
+ host: 'example.com',
40
+ },
41
+ null,
42
+ ])
43
+ })
44
+
45
+ it('normalizes "(port, host, callback)"', () => {
46
+ const callback = () => {}
47
+
48
+ expect(normalizeNetConnectArgs([8080, 'example.com', callback])).toEqual([
49
+ {
50
+ port: 8080,
51
+ path: '',
52
+ host: 'example.com',
53
+ },
54
+ callback,
55
+ ])
56
+ })
57
+
58
+ it('normalizes a zero port', () => {
59
+ expect(normalizeNetConnectArgs([0, 'example.com'])).toEqual([
60
+ {
61
+ port: 0,
62
+ path: '',
63
+ host: 'example.com',
64
+ },
65
+ null,
66
+ ])
67
+ })
68
+
69
+ it('normalizes "(options)"', () => {
70
+ expect(
71
+ normalizeNetConnectArgs([{ port: 8080, host: 'example.com' }])
72
+ ).toEqual([
73
+ {
74
+ port: 8080,
75
+ path: '',
76
+ host: 'example.com',
77
+ auth: undefined,
78
+ family: undefined,
79
+ session: undefined,
80
+ localAddress: undefined,
81
+ localPort: undefined,
82
+ },
83
+ null,
84
+ ])
85
+ })
86
+
87
+ it('normalizes "(options, callback)"', () => {
88
+ const callback = () => {}
89
+
90
+ expect(
91
+ normalizeNetConnectArgs([{ port: 8080, host: 'example.com' }, callback])
92
+ ).toEqual([
93
+ {
94
+ port: 8080,
95
+ path: '',
96
+ host: 'example.com',
97
+ },
98
+ callback,
99
+ ])
100
+ })
101
+
102
+ it('normalizes "(options)" with connection-specific options', () => {
103
+ const session = Buffer.from('session')
104
+
105
+ expect(
106
+ normalizeNetConnectArgs([
107
+ {
108
+ port: 8080,
109
+ host: 'example.com',
110
+ family: 6,
111
+ localAddress: '10.0.0.1',
112
+ localPort: 34567,
113
+ },
114
+ ])
115
+ ).toEqual([
116
+ {
117
+ port: 8080,
118
+ path: '',
119
+ host: 'example.com',
120
+ family: 6,
121
+ localAddress: '10.0.0.1',
122
+ localPort: 34567,
123
+ },
124
+ null,
125
+ ])
126
+
127
+ expect(
128
+ normalizeNetConnectArgs([
129
+ // The type definitions of "net.connect()" omit
130
+ // the TLS-specific options ("auth", "session").
131
+ Object.assign({ port: 8080 }, { auth: 'user:pass', session }),
132
+ ])
133
+ ).toEqual([
134
+ expect.objectContaining({
135
+ port: 8080,
136
+ auth: 'user:pass',
137
+ session,
138
+ }),
139
+ null,
140
+ ])
141
+ })
142
+
143
+ it('normalizes "(options)" with the "path" option', () => {
144
+ expect(normalizeNetConnectArgs([{ path: '/tmp/service.sock' }])).toEqual([
145
+ {
146
+ path: '/tmp/service.sock',
147
+ auth: undefined,
148
+ family: undefined,
149
+ session: undefined,
150
+ },
151
+ null,
152
+ ])
153
+ })
154
+
155
+ it('normalizes "(path)"', () => {
156
+ expect(normalizeNetConnectArgs(['/tmp/service.sock'])).toEqual([
157
+ {
158
+ path: '/tmp/service.sock',
159
+ },
160
+ null,
161
+ ])
162
+ })
163
+
164
+ it('normalizes "(path, callback)"', () => {
165
+ const callback = () => {}
166
+
167
+ expect(normalizeNetConnectArgs(['/tmp/service.sock', callback])).toEqual([
168
+ {
169
+ path: '/tmp/service.sock',
170
+ },
171
+ callback,
172
+ ])
173
+ })
174
+
175
+ /**
176
+ * @note Node.js does not support URL arguments and reads them
177
+ * as plain options objects. Reproduce that reading exactly:
178
+ * "url.port" is a string, "url.host" includes the port.
179
+ */
180
+ it('treats "(url)" as a plain options object, like Node.js', () => {
181
+ expect(
182
+ normalizeNetConnectArgs([new URL('http://example.com:8080/path?query=1')])
183
+ ).toEqual([
184
+ {
185
+ path: '',
186
+ port: '8080',
187
+ host: 'example.com:8080',
188
+ },
189
+ null,
190
+ ])
191
+ })
192
+
193
+ it('treats a port-less "(url)" as a plain options object, like Node.js', () => {
194
+ expect(normalizeNetConnectArgs([new URL('http://example.com/')])).toEqual([
195
+ {
196
+ path: '',
197
+ port: '',
198
+ host: 'example.com',
199
+ },
200
+ null,
201
+ ])
202
+ })
203
+
204
+ it('normalizes "(url, callback)"', () => {
205
+ const callback = () => {}
206
+
207
+ expect(
208
+ normalizeNetConnectArgs([new URL('http://example.com:8080/'), callback])
209
+ ).toEqual([
210
+ expect.objectContaining({
211
+ port: '8080',
212
+ host: 'example.com:8080',
213
+ }),
214
+ callback,
215
+ ])
216
+ })
217
+
218
+ it('returns a new options object for the "(options)" signature', () => {
219
+ const inputOptions = { port: 8080, host: 'example.com' }
220
+ const [normalizedOptions] = normalizeNetConnectArgs([inputOptions])
221
+
222
+ expect(normalizedOptions).not.toBe(inputOptions)
223
+
224
+ // Modifying the normalized options must not affect the input.
225
+ normalizedOptions.host = 'changed.com'
226
+ expect(inputOptions).toEqual({ port: 8080, host: 'example.com' })
227
+ })
228
+
229
+ it('throws on invalid arguments', () => {
230
+ expect(() => {
231
+ return normalizeNetConnectArgs([true] as unknown as NetConnectArgs)
232
+ }).toThrow('Invalid arguments passed to net.connect: true')
233
+ })
@@ -0,0 +1,121 @@
1
+ import net from 'node:net'
2
+
3
+ export interface NetworkConnectionOptions {
4
+ /**
5
+ * @note The port may be a string when a URL is (incorrectly) passed
6
+ * to `net.connect()`. Node.js reads URLs as plain options objects.
7
+ */
8
+ port?: number | string | null
9
+ path: string | null
10
+ host?: string | null
11
+ protocol?: string | null
12
+ auth?: string | null
13
+ family?: number | null
14
+ hints?: number | null
15
+ session?: Buffer
16
+ localAddress?: string | null
17
+ localPort?: number | null
18
+ timeout?: number
19
+ lookup?: net.LookupFunction
20
+ allowHalfOpen?: boolean | null
21
+ noDelay?: boolean | null
22
+ keepAlive?: boolean | null
23
+ keepAliveInitialDelay?: number | null
24
+ autoSelectFamily?: boolean | null
25
+ autoSelectFamilyAttemptTimeout?: number | null
26
+ }
27
+
28
+ export type NetConnectArgs =
29
+ | []
30
+ | [options: net.NetConnectOpts, callback?: () => void]
31
+ | [url: URL, callback?: () => void]
32
+ | [port: number, host?: string, callback?: () => void]
33
+ | [port: number, callback?: () => void]
34
+ | [path: string, callback?: () => void]
35
+
36
+ export type NormalizedNetConnectArgs = [
37
+ options: NetworkConnectionOptions,
38
+ callback: (() => void) | null,
39
+ ]
40
+
41
+ /**
42
+ * Normalizes the arguments passed to `net.connect()`.
43
+ */
44
+ export function normalizeNetConnectArgs(
45
+ args: NetConnectArgs
46
+ ): NormalizedNetConnectArgs {
47
+ if (args.length === 0) {
48
+ return [{ path: '' }, null]
49
+ }
50
+
51
+ const callback = typeof args[1] === 'function' ? args[1] : args[2] || null
52
+
53
+ if (typeof args[0] === 'string') {
54
+ return [{ path: args[0] }, callback]
55
+ }
56
+
57
+ if (typeof args[0] === 'number') {
58
+ return [
59
+ {
60
+ port: args[0],
61
+ path: '',
62
+ /**
63
+ * @note The host is optional in the "(port[, host][, callback])"
64
+ * signatures and defaults to "localhost" in Node.js.
65
+ */
66
+ host: typeof args[1] === 'string' ? args[1] : undefined,
67
+ },
68
+ callback,
69
+ ]
70
+ }
71
+
72
+ if (typeof args[0] === 'object') {
73
+ /**
74
+ * @note URL arguments receive no special treatment on purpose.
75
+ * Node.js does not support them and reads a given URL as a plain
76
+ * options object (e.g. "url.port" is a string, "url.host" includes
77
+ * the port). The "port" branch below reproduces that reading.
78
+ */
79
+ if ('port' in args[0]) {
80
+ return [
81
+ {
82
+ path: '',
83
+ port: Reflect.get(args[0], 'port'),
84
+ host: Reflect.get(args[0], 'host'),
85
+ auth: Reflect.get(args[0], 'auth'),
86
+ family: Reflect.get(args[0], 'family'),
87
+ hints: Reflect.get(args[0], 'hints'),
88
+ session: Reflect.get(args[0], 'session'),
89
+ localAddress: Reflect.get(args[0], 'localAddress'),
90
+ localPort: Reflect.get(args[0], 'localPort'),
91
+ timeout: Reflect.get(args[0], 'timeout'),
92
+ lookup: Reflect.get(args[0], 'lookup'),
93
+ allowHalfOpen: Reflect.get(args[0], 'allowHalfOpen'),
94
+ noDelay: Reflect.get(args[0], 'noDelay'),
95
+ keepAlive: Reflect.get(args[0], 'keepAlive'),
96
+ keepAliveInitialDelay: Reflect.get(args[0], 'keepAliveInitialDelay'),
97
+ autoSelectFamily: Reflect.get(args[0], 'autoSelectFamily'),
98
+ autoSelectFamilyAttemptTimeout: Reflect.get(
99
+ args[0],
100
+ 'autoSelectFamilyAttemptTimeout'
101
+ ),
102
+ },
103
+ callback,
104
+ ]
105
+ }
106
+
107
+ return [
108
+ {
109
+ path: args[0].path || '',
110
+ family: Reflect.get(args[0], 'family'),
111
+ session: Reflect.get(args[0], 'session'),
112
+ auth: Reflect.get(args[0], 'auth'),
113
+ timeout: Reflect.get(args[0], 'timeout'),
114
+ allowHalfOpen: Reflect.get(args[0], 'allowHalfOpen'),
115
+ },
116
+ callback,
117
+ ]
118
+ }
119
+
120
+ throw new Error(`Invalid arguments passed to net.connect: ${args}`)
121
+ }
@@ -0,0 +1,50 @@
1
+ import tls from 'node:tls'
2
+ import {
3
+ type NetConnectArgs,
4
+ type NetworkConnectionOptions,
5
+ normalizeNetConnectArgs,
6
+ } from './normalize-net-connect-args'
7
+
8
+ type TlsConnectArgs =
9
+ | []
10
+ | [options: tls.ConnectionOptions, callback?: () => void]
11
+ | [url: URL, callback?: () => void]
12
+ | [port: number, options?: tls.ConnectionOptions, callback?: () => void]
13
+ | [
14
+ port: number,
15
+ host?: string,
16
+ options?: tls.ConnectionOptions,
17
+ callback?: () => void,
18
+ ]
19
+
20
+ export type TlsConnectionOptions = tls.ConnectionOptions &
21
+ NetworkConnectionOptions
22
+
23
+ type NormalizedTlsConnectionArgs = [
24
+ options: TlsConnectionOptions,
25
+ callback?: () => void,
26
+ ]
27
+
28
+ export function normalizeTlsConnectArgs(
29
+ args: TlsConnectArgs
30
+ ): NormalizedTlsConnectionArgs {
31
+ /**
32
+ * @note Despite incorrect type definitions, "tls.connect()" has all the
33
+ * options of "net.connect()" and then those specific to TLS connections,
34
+ * like "session" or "socket".
35
+ * @see https://github.com/nodejs/node/blob/bdc8131fa78089b81b74dbff467365afb6536e6a/lib/internal/tls/wrap.js#L1615
36
+ */
37
+ const netConnectArgs = normalizeNetConnectArgs(args as NetConnectArgs)
38
+ const options = netConnectArgs[0] as TlsConnectionOptions
39
+ const callback = netConnectArgs[1]
40
+
41
+ if (args[0] !== null && typeof args[0] === 'object') {
42
+ Object.assign(options, args[0])
43
+ } else if (args[1] !== null && typeof args[1] === 'object') {
44
+ Object.assign(options, args[1])
45
+ } else if (args[2] !== null && typeof args[2] === 'object') {
46
+ Object.assign(options, args[2])
47
+ }
48
+
49
+ return callback ? [options, callback] : [options]
50
+ }
@@ -1,9 +1,9 @@
1
- import { FetchInterceptor } from '../interceptors/fetch'
2
- import { XMLHttpRequestInterceptor } from '../interceptors/XMLHttpRequest'
1
+ import { FetchInterceptor } from '../interceptors/fetch/web'
2
+ import { XMLHttpRequestInterceptor } from '../interceptors/XMLHttpRequest/web'
3
3
 
4
4
  /**
5
- * The default preset provisions the interception of requests
6
- * regardless of their type (fetch/XMLHttpRequest).
5
+ * A browser preset for the request interception regardless
6
+ * of their initiator (fetch, XMLHttpRequest).
7
7
  */
8
8
  export default [
9
9
  new FetchInterceptor(),
@@ -1,10 +1,10 @@
1
1
  import { ClientRequestInterceptor } from '../interceptors/ClientRequest'
2
- import { XMLHttpRequestInterceptor } from '../interceptors/XMLHttpRequest'
3
- import { FetchInterceptor } from '../interceptors/fetch'
2
+ import { XMLHttpRequestInterceptor } from '../interceptors/XMLHttpRequest/node'
3
+ import { FetchInterceptor } from '../interceptors/fetch/node'
4
4
 
5
5
  /**
6
- * The default preset provisions the interception of requests
7
- * regardless of their type (http/https/XMLHttpRequest).
6
+ * A Node.js preset for the request interception regardless
7
+ * of their initiator (http, fetch, XMLHttpRequest).
8
8
  */
9
9
  export default [
10
10
  new ClientRequestInterceptor(),