@mswjs/interceptors
Advanced tools
Comparing version 0.26.13 to 0.26.14
@@ -29,2 +29,10 @@ export { H as HttpRequestEventMap, I as IS_PATCHED_MODULE, R as RequestCredentials } from './glossary-640c9679.js'; | ||
/** | ||
* Generate a random ID string to represent a request. | ||
* @example | ||
* createRequestId() | ||
* // "f774b6c9c600f" | ||
*/ | ||
declare function createRequestId(): string; | ||
/** | ||
* Removes query parameters and hashes from a given URL. | ||
@@ -43,2 +51,2 @@ */ | ||
export { BatchInterceptor, BatchInterceptorOptions, ExtractEventMapType, ExtractEventNames, Interceptor, decodeBuffer, encodeBuffer, getCleanUrl, isResponseWithoutBody }; | ||
export { BatchInterceptor, BatchInterceptorOptions, ExtractEventMapType, ExtractEventNames, Interceptor, createRequestId, decodeBuffer, encodeBuffer, getCleanUrl, isResponseWithoutBody }; |
@@ -15,6 +15,7 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunk3PGRU2BRjs = require('./chunk-3PGRU2BR.js'); | ||
var _chunkTIPR373Rjs = require('./chunk-TIPR373R.js'); | ||
// src/BatchInterceptor.ts | ||
var BatchInterceptor = class extends _chunk3PGRU2BRjs.Interceptor { | ||
var BatchInterceptor = class extends _chunkTIPR373Rjs.Interceptor { | ||
constructor(options) { | ||
@@ -77,3 +78,4 @@ BatchInterceptor.symbol = Symbol(options.name); | ||
exports.BatchInterceptor = BatchInterceptor; exports.INTERNAL_REQUEST_ID_HEADER_NAME = _chunk3PGRU2BRjs.INTERNAL_REQUEST_ID_HEADER_NAME; exports.IS_PATCHED_MODULE = _chunkFZJKKO5Hjs.IS_PATCHED_MODULE; exports.Interceptor = _chunk3PGRU2BRjs.Interceptor; exports.InterceptorReadyState = _chunk3PGRU2BRjs.InterceptorReadyState; exports.decodeBuffer = _chunkOJ2CN4LSjs.decodeBuffer; exports.deleteGlobalSymbol = _chunk3PGRU2BRjs.deleteGlobalSymbol; exports.encodeBuffer = _chunkOJ2CN4LSjs.encodeBuffer; exports.getCleanUrl = getCleanUrl; exports.getGlobalSymbol = _chunk3PGRU2BRjs.getGlobalSymbol; exports.isResponseWithoutBody = _chunkOJ2CN4LSjs.isResponseWithoutBody; | ||
exports.BatchInterceptor = BatchInterceptor; exports.INTERNAL_REQUEST_ID_HEADER_NAME = _chunkTIPR373Rjs.INTERNAL_REQUEST_ID_HEADER_NAME; exports.IS_PATCHED_MODULE = _chunkFZJKKO5Hjs.IS_PATCHED_MODULE; exports.Interceptor = _chunkTIPR373Rjs.Interceptor; exports.InterceptorReadyState = _chunkTIPR373Rjs.InterceptorReadyState; exports.createRequestId = _chunkTIPR373Rjs.createRequestId; exports.decodeBuffer = _chunkOJ2CN4LSjs.decodeBuffer; exports.deleteGlobalSymbol = _chunkTIPR373Rjs.deleteGlobalSymbol; exports.encodeBuffer = _chunkOJ2CN4LSjs.encodeBuffer; exports.getCleanUrl = getCleanUrl; exports.getGlobalSymbol = _chunkTIPR373Rjs.getGlobalSymbol; exports.isResponseWithoutBody = _chunkOJ2CN4LSjs.isResponseWithoutBody; | ||
//# sourceMappingURL=index.js.map |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkN6P4WNMDjs = require('../../chunk-N6P4WNMD.js'); | ||
var _chunkDFOMNPZ4js = require('../../chunk-DFOMNPZ4.js'); | ||
require('../../chunk-MQJ3JOOK.js'); | ||
require('../../chunk-FZJKKO5H.js'); | ||
require('../../chunk-3PGRU2BR.js'); | ||
require('../../chunk-TIPR373R.js'); | ||
exports.FetchInterceptor = _chunkN6P4WNMDjs.FetchInterceptor; | ||
exports.FetchInterceptor = _chunkDFOMNPZ4js.FetchInterceptor; | ||
//# sourceMappingURL=index.js.map |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunk3PGRU2BRjs = require('../../chunk-3PGRU2BR.js'); | ||
var _chunkTIPR373Rjs = require('../../chunk-TIPR373R.js'); | ||
// src/interceptors/WebSocket/utils/bindEvent.ts | ||
function bindEvent(target, event) { | ||
Object.defineProperty(event, "target", { | ||
enumerable: true, | ||
writable: true, | ||
value: target | ||
Object.defineProperties(event, { | ||
target: { | ||
value: target, | ||
enumerable: true, | ||
writable: true | ||
}, | ||
currentTarget: { | ||
value: target, | ||
enumerable: true, | ||
writable: true | ||
} | ||
}); | ||
@@ -52,3 +60,3 @@ return event; | ||
this.transport = transport; | ||
this.id = crypto.randomUUID(); | ||
this.id = _chunkTIPR373Rjs.createRequestId.call(void 0, ); | ||
this.url = new URL(socket.url); | ||
@@ -455,3 +463,3 @@ this[kEmitter] = new EventTarget(); | ||
// src/interceptors/WebSocket/index.ts | ||
var _WebSocketInterceptor = class extends _chunk3PGRU2BRjs.Interceptor { | ||
var _WebSocketInterceptor = class extends _chunkTIPR373Rjs.Interceptor { | ||
constructor() { | ||
@@ -458,0 +466,0 @@ super(_WebSocketInterceptor.symbol); |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunk5HSEVANCjs = require('../../chunk-5HSEVANC.js'); | ||
var _chunk65PS3XCBjs = require('../../chunk-65PS3XCB.js'); | ||
require('../../chunk-OJ2CN4LS.js'); | ||
require('../../chunk-MQJ3JOOK.js'); | ||
require('../../chunk-FZJKKO5H.js'); | ||
require('../../chunk-3PGRU2BR.js'); | ||
require('../../chunk-TIPR373R.js'); | ||
exports.XMLHttpRequestInterceptor = _chunk5HSEVANCjs.XMLHttpRequestInterceptor; | ||
exports.XMLHttpRequestInterceptor = _chunk65PS3XCBjs.XMLHttpRequestInterceptor; | ||
//# sourceMappingURL=index.js.map |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunk5HSEVANCjs = require('../chunk-5HSEVANC.js'); | ||
var _chunk65PS3XCBjs = require('../chunk-65PS3XCB.js'); | ||
require('../chunk-OJ2CN4LS.js'); | ||
var _chunkN6P4WNMDjs = require('../chunk-N6P4WNMD.js'); | ||
var _chunkDFOMNPZ4js = require('../chunk-DFOMNPZ4.js'); | ||
require('../chunk-MQJ3JOOK.js'); | ||
require('../chunk-FZJKKO5H.js'); | ||
require('../chunk-3PGRU2BR.js'); | ||
require('../chunk-TIPR373R.js'); | ||
// src/presets/browser.ts | ||
var browser_default = [ | ||
new (0, _chunkN6P4WNMDjs.FetchInterceptor)(), | ||
new (0, _chunk5HSEVANCjs.XMLHttpRequestInterceptor)() | ||
new (0, _chunkDFOMNPZ4js.FetchInterceptor)(), | ||
new (0, _chunk65PS3XCBjs.XMLHttpRequestInterceptor)() | ||
]; | ||
@@ -17,0 +17,0 @@ |
@@ -8,2 +8,10 @@ export { E as ExtractEventNames, H as HttpRequestEventMap, c as INTERNAL_REQUEST_ID_HEADER_NAME, I as IS_PATCHED_MODULE, f as Interceptor, a as InterceptorEventMap, e as InterceptorReadyState, b as InterceptorSubscription, R as RequestCredentials, d as deleteGlobalSymbol, g as getGlobalSymbol } from './Interceptor-6696a18d.js'; | ||
/** | ||
* Generate a random ID string to represent a request. | ||
* @example | ||
* createRequestId() | ||
* // "f774b6c9c600f" | ||
*/ | ||
declare function createRequestId(): string; | ||
/** | ||
* Removes query parameters and hashes from a given URL. | ||
@@ -22,2 +30,2 @@ */ | ||
export { decodeBuffer, encodeBuffer, getCleanUrl, isResponseWithoutBody }; | ||
export { createRequestId, decodeBuffer, encodeBuffer, getCleanUrl, isResponseWithoutBody }; |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkZ2GCDAWNjs = require('./chunk-Z2GCDAWN.js'); | ||
var _chunkLMCO6WE2js = require('./chunk-LMCO6WE2.js'); | ||
var _chunkDWNXSX4Rjs = require('./chunk-DWNXSX4R.js'); | ||
var _chunkLK6DILFKjs = require('./chunk-LK6DILFK.js'); | ||
var _chunkXRANZXDYjs = require('./chunk-XRANZXDY.js'); | ||
var _chunkJSSEHRRBjs = require('./chunk-JSSEHRRB.js'); | ||
var _chunkHOHLBCZOjs = require('./chunk-HOHLBCZO.js'); | ||
var _chunkFZJKKO5Hjs = require('./chunk-FZJKKO5H.js'); | ||
@@ -20,4 +20,5 @@ | ||
var _chunkQ2ZAXW2Vjs = require('./chunk-Q2ZAXW2V.js'); | ||
var _chunkTIPR373Rjs = require('./chunk-TIPR373R.js'); | ||
// src/utils/getCleanUrl.ts | ||
@@ -39,3 +40,4 @@ function getCleanUrl(url, isAbsolute = true) { | ||
exports.BatchInterceptor = _chunkZ2GCDAWNjs.BatchInterceptor; exports.INTERNAL_REQUEST_ID_HEADER_NAME = _chunkQ2ZAXW2Vjs.INTERNAL_REQUEST_ID_HEADER_NAME; exports.IS_PATCHED_MODULE = _chunkHOHLBCZOjs.IS_PATCHED_MODULE; exports.Interceptor = _chunkQ2ZAXW2Vjs.Interceptor; exports.InterceptorReadyState = _chunkQ2ZAXW2Vjs.InterceptorReadyState; exports.decodeBuffer = _chunkDWNXSX4Rjs.decodeBuffer; exports.deleteGlobalSymbol = _chunkQ2ZAXW2Vjs.deleteGlobalSymbol; exports.encodeBuffer = _chunkDWNXSX4Rjs.encodeBuffer; exports.getCleanUrl = getCleanUrl; exports.getGlobalSymbol = _chunkQ2ZAXW2Vjs.getGlobalSymbol; exports.isResponseWithoutBody = _chunkXRANZXDYjs.isResponseWithoutBody; | ||
exports.BatchInterceptor = _chunkLMCO6WE2js.BatchInterceptor; exports.INTERNAL_REQUEST_ID_HEADER_NAME = _chunkTIPR373Rjs.INTERNAL_REQUEST_ID_HEADER_NAME; exports.IS_PATCHED_MODULE = _chunkFZJKKO5Hjs.IS_PATCHED_MODULE; exports.Interceptor = _chunkTIPR373Rjs.Interceptor; exports.InterceptorReadyState = _chunkTIPR373Rjs.InterceptorReadyState; exports.createRequestId = _chunkTIPR373Rjs.createRequestId; exports.decodeBuffer = _chunkLK6DILFKjs.decodeBuffer; exports.deleteGlobalSymbol = _chunkTIPR373Rjs.deleteGlobalSymbol; exports.encodeBuffer = _chunkLK6DILFKjs.encodeBuffer; exports.getCleanUrl = getCleanUrl; exports.getGlobalSymbol = _chunkTIPR373Rjs.getGlobalSymbol; exports.isResponseWithoutBody = _chunkJSSEHRRBjs.isResponseWithoutBody; | ||
//# sourceMappingURL=index.js.map |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkZOS6ZFFLjs = require('../../chunk-ZOS6ZFFL.js'); | ||
require('../../chunk-XRANZXDY.js'); | ||
require('../../chunk-OQFUVENL.js'); | ||
require('../../chunk-AQD7SRYT.js'); | ||
require('../../chunk-Q2ZAXW2V.js'); | ||
var _chunk7I24Q7UYjs = require('../../chunk-7I24Q7UY.js'); | ||
require('../../chunk-JSSEHRRB.js'); | ||
require('../../chunk-Y6GRL6UD.js'); | ||
require('../../chunk-MQJ3JOOK.js'); | ||
require('../../chunk-TIPR373R.js'); | ||
exports.ClientRequestInterceptor = _chunkZOS6ZFFLjs.ClientRequestInterceptor; | ||
exports.ClientRequestInterceptor = _chunk7I24Q7UYjs.ClientRequestInterceptor; | ||
//# sourceMappingURL=index.js.map |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkOQFUVENLjs = require('../../chunk-OQFUVENL.js'); | ||
var _chunkY6GRL6UDjs = require('../../chunk-Y6GRL6UD.js'); | ||
var _chunkHOHLBCZOjs = require('../../chunk-HOHLBCZO.js'); | ||
var _chunkFZJKKO5Hjs = require('../../chunk-FZJKKO5H.js'); | ||
var _chunkAQD7SRYTjs = require('../../chunk-AQD7SRYT.js'); | ||
var _chunkMQJ3JOOKjs = require('../../chunk-MQJ3JOOK.js'); | ||
var _chunkQ2ZAXW2Vjs = require('../../chunk-Q2ZAXW2V.js'); | ||
var _chunkTIPR373Rjs = require('../../chunk-TIPR373R.js'); | ||
@@ -32,3 +32,3 @@ // src/interceptors/fetch/index.ts | ||
// src/interceptors/fetch/index.ts | ||
var _FetchInterceptor = class extends _chunkQ2ZAXW2Vjs.Interceptor { | ||
var _FetchInterceptor = class extends _chunkTIPR373Rjs.Interceptor { | ||
constructor() { | ||
@@ -43,3 +43,3 @@ super(_FetchInterceptor.symbol); | ||
_outvariant.invariant.call(void 0, | ||
!pureFetch[_chunkHOHLBCZOjs.IS_PATCHED_MODULE], | ||
!pureFetch[_chunkFZJKKO5Hjs.IS_PATCHED_MODULE], | ||
'Failed to patch the "fetch" module: already patched.' | ||
@@ -49,7 +49,7 @@ ); | ||
var _a; | ||
const requestId = _chunkQ2ZAXW2Vjs.crypto.randomUUID(); | ||
const requestId = _chunkTIPR373Rjs.createRequestId.call(void 0, ); | ||
const resolvedInput = typeof input === "string" && typeof location !== "undefined" && !canParseUrl(input) ? new URL(input, location.origin) : input; | ||
const request = new Request(resolvedInput, init); | ||
this.logger.info("[%s] %s", request.method, request.url); | ||
const { interactiveRequest, requestController } = _chunkAQD7SRYTjs.toInteractiveRequest.call(void 0, request); | ||
const { interactiveRequest, requestController } = _chunkMQJ3JOOKjs.toInteractiveRequest.call(void 0, request); | ||
this.logger.info( | ||
@@ -80,3 +80,3 @@ 'emitting the "request" event for %d listener(s)...', | ||
const resolverResult = await _until.until.call(void 0, async () => { | ||
const listenersFinished = _chunkAQD7SRYTjs.emitAsync.call(void 0, this.emitter, "request", { | ||
const listenersFinished = _chunkMQJ3JOOKjs.emitAsync.call(void 0, this.emitter, "request", { | ||
request: interactiveRequest, | ||
@@ -107,3 +107,3 @@ requestId | ||
this.logger.info("received mocked response:", mockedResponse); | ||
if (_chunkOQFUVENLjs.isPropertyAccessible.call(void 0, mockedResponse, "type") && mockedResponse.type === "error") { | ||
if (_chunkY6GRL6UDjs.isPropertyAccessible.call(void 0, mockedResponse, "type") && mockedResponse.type === "error") { | ||
this.logger.info( | ||
@@ -142,3 +142,3 @@ "received a network error response, rejecting the request promise..." | ||
}; | ||
Object.defineProperty(globalThis.fetch, _chunkHOHLBCZOjs.IS_PATCHED_MODULE, { | ||
Object.defineProperty(globalThis.fetch, _chunkFZJKKO5Hjs.IS_PATCHED_MODULE, { | ||
enumerable: true, | ||
@@ -149,3 +149,3 @@ configurable: true, | ||
this.subscriptions.push(() => { | ||
Object.defineProperty(globalThis.fetch, _chunkHOHLBCZOjs.IS_PATCHED_MODULE, { | ||
Object.defineProperty(globalThis.fetch, _chunkFZJKKO5Hjs.IS_PATCHED_MODULE, { | ||
value: void 0 | ||
@@ -152,0 +152,0 @@ }); |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkWJBJLZSKjs = require('../../chunk-WJBJLZSK.js'); | ||
require('../../chunk-DWNXSX4R.js'); | ||
require('../../chunk-XRANZXDY.js'); | ||
require('../../chunk-HOHLBCZO.js'); | ||
require('../../chunk-AQD7SRYT.js'); | ||
require('../../chunk-Q2ZAXW2V.js'); | ||
var _chunkK74ZLSG6js = require('../../chunk-K74ZLSG6.js'); | ||
require('../../chunk-LK6DILFK.js'); | ||
require('../../chunk-JSSEHRRB.js'); | ||
require('../../chunk-FZJKKO5H.js'); | ||
require('../../chunk-MQJ3JOOK.js'); | ||
require('../../chunk-TIPR373R.js'); | ||
exports.XMLHttpRequestInterceptor = _chunkWJBJLZSKjs.XMLHttpRequestInterceptor; | ||
exports.XMLHttpRequestInterceptor = _chunkK74ZLSG6js.XMLHttpRequestInterceptor; | ||
//# sourceMappingURL=index.js.map |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkZOS6ZFFLjs = require('../chunk-ZOS6ZFFL.js'); | ||
var _chunk7I24Q7UYjs = require('../chunk-7I24Q7UY.js'); | ||
var _chunkWJBJLZSKjs = require('../chunk-WJBJLZSK.js'); | ||
require('../chunk-DWNXSX4R.js'); | ||
require('../chunk-XRANZXDY.js'); | ||
require('../chunk-OQFUVENL.js'); | ||
require('../chunk-HOHLBCZO.js'); | ||
require('../chunk-AQD7SRYT.js'); | ||
require('../chunk-Q2ZAXW2V.js'); | ||
var _chunkK74ZLSG6js = require('../chunk-K74ZLSG6.js'); | ||
require('../chunk-LK6DILFK.js'); | ||
require('../chunk-JSSEHRRB.js'); | ||
require('../chunk-Y6GRL6UD.js'); | ||
require('../chunk-FZJKKO5H.js'); | ||
require('../chunk-MQJ3JOOK.js'); | ||
require('../chunk-TIPR373R.js'); | ||
// src/presets/node.ts | ||
var node_default = [ | ||
new (0, _chunkZOS6ZFFLjs.ClientRequestInterceptor)(), | ||
new (0, _chunkWJBJLZSKjs.XMLHttpRequestInterceptor)() | ||
new (0, _chunk7I24Q7UYjs.ClientRequestInterceptor)(), | ||
new (0, _chunkK74ZLSG6js.XMLHttpRequestInterceptor)() | ||
]; | ||
@@ -19,0 +19,0 @@ |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkZ2GCDAWNjs = require('./chunk-Z2GCDAWN.js'); | ||
var _chunkLMCO6WE2js = require('./chunk-LMCO6WE2.js'); | ||
var _chunkZOS6ZFFLjs = require('./chunk-ZOS6ZFFL.js'); | ||
var _chunk7I24Q7UYjs = require('./chunk-7I24Q7UY.js'); | ||
var _chunkWJBJLZSKjs = require('./chunk-WJBJLZSK.js'); | ||
require('./chunk-DWNXSX4R.js'); | ||
require('./chunk-XRANZXDY.js'); | ||
require('./chunk-OQFUVENL.js'); | ||
require('./chunk-HOHLBCZO.js'); | ||
var _chunkK74ZLSG6js = require('./chunk-K74ZLSG6.js'); | ||
require('./chunk-LK6DILFK.js'); | ||
require('./chunk-JSSEHRRB.js'); | ||
require('./chunk-Y6GRL6UD.js'); | ||
require('./chunk-FZJKKO5H.js'); | ||
var _chunkAQD7SRYTjs = require('./chunk-AQD7SRYT.js'); | ||
var _chunkMQJ3JOOKjs = require('./chunk-MQJ3JOOK.js'); | ||
var _chunkQ2ZAXW2Vjs = require('./chunk-Q2ZAXW2V.js'); | ||
var _chunkTIPR373Rjs = require('./chunk-TIPR373R.js'); | ||
// src/RemoteHttpInterceptor.ts | ||
var RemoteHttpInterceptor = class extends _chunkZ2GCDAWNjs.BatchInterceptor { | ||
var RemoteHttpInterceptor = class extends _chunkLMCO6WE2js.BatchInterceptor { | ||
constructor() { | ||
@@ -28,4 +28,4 @@ super({ | ||
interceptors: [ | ||
new (0, _chunkZOS6ZFFLjs.ClientRequestInterceptor)(), | ||
new (0, _chunkWJBJLZSKjs.XMLHttpRequestInterceptor)() | ||
new (0, _chunk7I24Q7UYjs.ClientRequestInterceptor)(), | ||
new (0, _chunkK74ZLSG6js.XMLHttpRequestInterceptor)() | ||
] | ||
@@ -97,3 +97,3 @@ }); | ||
} | ||
var _RemoteHttpResolver = class extends _chunkQ2ZAXW2Vjs.Interceptor { | ||
var _RemoteHttpResolver = class extends _chunkTIPR373Rjs.Interceptor { | ||
constructor(options) { | ||
@@ -126,3 +126,3 @@ super(_RemoteHttpResolver.symbol); | ||
}); | ||
const { interactiveRequest, requestController } = _chunkAQD7SRYTjs.toInteractiveRequest.call(void 0, capturedRequest); | ||
const { interactiveRequest, requestController } = _chunkMQJ3JOOKjs.toInteractiveRequest.call(void 0, capturedRequest); | ||
this.emitter.once("request", () => { | ||
@@ -133,3 +133,3 @@ if (requestController.responsePromise.state === "pending") { | ||
}); | ||
await _chunkAQD7SRYTjs.emitAsync.call(void 0, this.emitter, "request", { | ||
await _chunkMQJ3JOOKjs.emitAsync.call(void 0, this.emitter, "request", { | ||
request: interactiveRequest, | ||
@@ -136,0 +136,0 @@ requestId: requestJson.id |
{ | ||
"name": "@mswjs/interceptors", | ||
"description": "Low-level HTTP/HTTPS/XHR/fetch request interception library.", | ||
"version": "0.26.13", | ||
"version": "0.26.14", | ||
"main": "./lib/node/index.js", | ||
@@ -6,0 +6,0 @@ "module": "./lib/node/index.mjs", |
@@ -6,4 +6,5 @@ export * from './glossary' | ||
/* Utils */ | ||
export { createRequestId } from './createRequestId' | ||
export { getCleanUrl } from './utils/getCleanUrl' | ||
export { encodeBuffer, decodeBuffer } from './utils/bufferUtils' | ||
export { isResponseWithoutBody } from './utils/responseUtils' |
@@ -24,2 +24,3 @@ import { ClientRequest, IncomingMessage } from 'node:http' | ||
import { INTERNAL_REQUEST_ID_HEADER_NAME } from '../../Interceptor' | ||
import { createRequestId } from '../../createRequestId' | ||
@@ -155,3 +156,3 @@ export type Protocol = 'http' | 'https' | ||
const requestId = crypto.randomUUID() | ||
const requestId = createRequestId() | ||
@@ -158,0 +159,0 @@ const [chunk, encoding, callback] = normalizeClientRequestEndArgs(...args) |
@@ -10,2 +10,3 @@ import { invariant } from 'outvariant' | ||
import { canParseUrl } from '../../utils/canParseUrl' | ||
import { createRequestId } from '../../createRequestId' | ||
@@ -35,3 +36,3 @@ export class FetchInterceptor extends Interceptor<HttpRequestEventMap> { | ||
globalThis.fetch = async (input, init) => { | ||
const requestId = crypto.randomUUID() | ||
const requestId = createRequestId() | ||
@@ -38,0 +39,0 @@ /** |
@@ -7,8 +7,16 @@ type EventWithTarget<E extends Event, T> = E & { target: T } | ||
): EventWithTarget<E, T> { | ||
Object.defineProperty(event, 'target', { | ||
enumerable: true, | ||
writable: true, | ||
value: target, | ||
Object.defineProperties(event, { | ||
target: { | ||
value: target, | ||
enumerable: true, | ||
writable: true, | ||
}, | ||
currentTarget: { | ||
value: target, | ||
enumerable: true, | ||
writable: true, | ||
}, | ||
}) | ||
return event as EventWithTarget<E, T> | ||
} |
@@ -12,2 +12,3 @@ /** | ||
import { CloseEvent } from './utils/events' | ||
import { createRequestId } from '../../createRequestId' | ||
@@ -45,3 +46,3 @@ const kEmitter = Symbol('kEmitter') | ||
) { | ||
this.id = crypto.randomUUID() | ||
this.id = createRequestId() | ||
this.url = new URL(socket.url) | ||
@@ -48,0 +49,0 @@ this[kEmitter] = new EventTarget() |
@@ -16,2 +16,3 @@ import { invariant } from 'outvariant' | ||
import { INTERNAL_REQUEST_ID_HEADER_NAME } from '../../Interceptor' | ||
import { createRequestId } from '../../createRequestId' | ||
@@ -57,3 +58,3 @@ const IS_MOCKED_RESPONSE = Symbol('isMockedResponse') | ||
this.events = new Map() | ||
this.requestId = crypto.randomUUID() | ||
this.requestId = createRequestId() | ||
this.requestHeaders = new Headers() | ||
@@ -60,0 +61,0 @@ this.responseBuffer = new Uint8Array() |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1091716
208
14545