msw 2.14.6 → 2.14.7
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.
- package/README.md +5 -5
- package/lib/browser/index.js +232 -92
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/index.mjs +232 -92
- package/lib/browser/index.mjs.map +1 -1
- package/lib/core/{HttpResponse-CQwYpuKo.d.mts → HttpResponse-BTyqrRB6.d.mts} +1 -1
- package/lib/core/{HttpResponse-BFS34nkx.d.ts → HttpResponse-BXyXQFMJ.d.ts} +1 -1
- package/lib/core/HttpResponse.d.mts +1 -1
- package/lib/core/HttpResponse.d.ts +1 -1
- package/lib/core/HttpResponse.js +2 -2
- package/lib/core/HttpResponse.js.map +1 -1
- package/lib/core/HttpResponse.mjs +2 -2
- package/lib/core/HttpResponse.mjs.map +1 -1
- package/lib/core/experimental/compat.d.mts +2 -2
- package/lib/core/experimental/compat.d.ts +2 -2
- package/lib/core/experimental/define-network.d.mts +2 -2
- package/lib/core/experimental/define-network.d.ts +2 -2
- package/lib/core/experimental/frames/http-frame.d.mts +2 -2
- package/lib/core/experimental/frames/http-frame.d.ts +2 -2
- package/lib/core/experimental/frames/network-frame.d.mts +2 -2
- package/lib/core/experimental/frames/network-frame.d.ts +2 -2
- package/lib/core/experimental/frames/network-frame.js +2 -0
- package/lib/core/experimental/frames/network-frame.js.map +1 -1
- package/lib/core/experimental/frames/network-frame.mjs +2 -0
- package/lib/core/experimental/frames/network-frame.mjs.map +1 -1
- package/lib/core/experimental/frames/websocket-frame.d.mts +2 -2
- package/lib/core/experimental/frames/websocket-frame.d.ts +2 -2
- package/lib/core/experimental/handlers-controller.d.mts +1 -1
- package/lib/core/experimental/handlers-controller.d.ts +1 -1
- package/lib/core/experimental/index.d.mts +2 -2
- package/lib/core/experimental/index.d.ts +2 -2
- package/lib/core/experimental/on-unhandled-frame.d.mts +2 -2
- package/lib/core/experimental/on-unhandled-frame.d.ts +2 -2
- package/lib/core/experimental/setup-api.d.mts +1 -1
- package/lib/core/experimental/setup-api.d.ts +1 -1
- package/lib/core/experimental/sources/interceptor-source.d.mts +2 -2
- package/lib/core/experimental/sources/interceptor-source.d.ts +2 -2
- package/lib/core/experimental/sources/network-source.d.mts +2 -2
- package/lib/core/experimental/sources/network-source.d.ts +2 -2
- package/lib/core/getResponse.d.mts +1 -1
- package/lib/core/getResponse.d.ts +1 -1
- package/lib/core/graphql.d.mts +1 -1
- package/lib/core/graphql.d.ts +1 -1
- package/lib/core/handlers/GraphQLHandler.d.mts +1 -1
- package/lib/core/handlers/GraphQLHandler.d.ts +1 -1
- package/lib/core/handlers/HttpHandler.d.mts +1 -1
- package/lib/core/handlers/HttpHandler.d.ts +1 -1
- package/lib/core/handlers/RequestHandler.d.mts +1 -1
- package/lib/core/handlers/RequestHandler.d.ts +1 -1
- package/lib/core/handlers/WebSocketHandler.js +7 -6
- package/lib/core/handlers/WebSocketHandler.js.map +1 -1
- package/lib/core/handlers/WebSocketHandler.mjs +7 -6
- package/lib/core/handlers/WebSocketHandler.mjs.map +1 -1
- package/lib/core/http.d.mts +1 -1
- package/lib/core/http.d.ts +1 -1
- package/lib/core/index.d.mts +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/{on-unhandled-frame-BBR-P3kV.d.ts → on-unhandled-frame-0KmwUmeV.d.ts} +1 -1
- package/lib/core/{on-unhandled-frame-Cr1KOZ0I.d.mts → on-unhandled-frame-gkokW4Rr.d.mts} +1 -1
- package/lib/core/passthrough.d.mts +1 -1
- package/lib/core/passthrough.d.ts +1 -1
- package/lib/core/sse.d.mts +1 -1
- package/lib/core/sse.d.ts +1 -1
- package/lib/core/sse.js +18 -13
- package/lib/core/sse.js.map +1 -1
- package/lib/core/sse.mjs +18 -13
- package/lib/core/sse.mjs.map +1 -1
- package/lib/core/utils/HttpResponse/decorators.d.mts +1 -1
- package/lib/core/utils/HttpResponse/decorators.d.ts +1 -1
- package/lib/core/utils/HttpResponse/decorators.js +1 -1
- package/lib/core/utils/HttpResponse/decorators.js.map +1 -1
- package/lib/core/utils/HttpResponse/decorators.mjs +1 -1
- package/lib/core/utils/HttpResponse/decorators.mjs.map +1 -1
- package/lib/core/utils/executeHandlers.d.mts +1 -1
- package/lib/core/utils/executeHandlers.d.ts +1 -1
- package/lib/core/utils/handleRequest.d.mts +1 -1
- package/lib/core/utils/handleRequest.d.ts +1 -1
- package/lib/core/utils/internal/attachSiblingHandlers.d.mts +1 -1
- package/lib/core/utils/internal/attachSiblingHandlers.d.ts +1 -1
- package/lib/core/utils/internal/attachSiblingHandlers.js +1 -1
- package/lib/core/utils/internal/attachSiblingHandlers.js.map +1 -1
- package/lib/core/utils/internal/attachSiblingHandlers.mjs +1 -1
- package/lib/core/utils/internal/attachSiblingHandlers.mjs.map +1 -1
- package/lib/core/utils/internal/isHandlerKind.d.mts +1 -1
- package/lib/core/utils/internal/isHandlerKind.d.ts +1 -1
- package/lib/core/utils/internal/parseGraphQLRequest.d.mts +1 -1
- package/lib/core/utils/internal/parseGraphQLRequest.d.ts +1 -1
- package/lib/core/utils/internal/parseMultipartData.d.mts +1 -1
- package/lib/core/utils/internal/parseMultipartData.d.ts +1 -1
- package/lib/core/ws/WebSocketClientManager.js +4 -0
- package/lib/core/ws/WebSocketClientManager.js.map +1 -1
- package/lib/core/ws/WebSocketClientManager.mjs +4 -0
- package/lib/core/ws/WebSocketClientManager.mjs.map +1 -1
- package/lib/core/ws/handleWebSocketEvent.d.mts +1 -1
- package/lib/core/ws/handleWebSocketEvent.d.ts +1 -1
- package/lib/iife/index.js +4402 -972
- package/lib/iife/index.js.map +1 -1
- package/lib/mockServiceWorker.js +1 -1
- package/package.json +4 -5
- package/src/core/sse.ts +15 -4
|
@@ -368,4 +368,4 @@ declare class HttpResponse<BodyType extends DefaultBodyType> extends FetchRespon
|
|
|
368
368
|
static formData(body?: FormData, init?: HttpResponseInit): HttpResponse<FormData>;
|
|
369
369
|
}
|
|
370
370
|
|
|
371
|
-
export { type AsyncResponseResolverReturnType as A, type
|
|
371
|
+
export { type AsyncResponseResolverReturnType as A, type GraphQLCustomPredicateResult as B, type GraphQLHandlerInfo as C, type DefaultBodyType as D, type GraphQLHandlerNameSelector as E, type GraphQLRequestParsedResult as F, type GraphQLCustomPredicate as G, HttpResponse as H, isDocumentNode as I, type JsonBodyType as J, type RequestHandlerArgs as K, type RequestHandlerExecutionResult as L, type MaybeAsyncResponseResolverReturnType as M, type RequestHandlerInternalInfo as N, forwardResponseCookies as O, type ParsedGraphQLRequest as P, type DefaultUnsafeFetchResponse as Q, RequestHandler as R, type StrictRequest as S, bodyType as T, kDefaultContentType as U, type DefaultRequestMultipartBody as a, GraphQLHandler as b, type GraphQLJsonRequestBody as c, type GraphQLOperationType as d, type GraphQLQuery as e, type GraphQLRequestBody as f, type GraphQLResponseBody as g, type GraphQLVariables as h, type HttpResponseInit as i, type RequestHandlerOptions as j, type ResponseResolutionContext as k, type ResponseResolver as l, type ResponseResolverInfo as m, type ResponseResolverReturnType as n, type StrictResponse as o, type GraphQLPredicate as p, type GraphQLResolverExtras as q, type RequestHandlerDefaultInfo as r, type HandlersExecutionResult as s, executeHandlers as t, type GraphQLMultipartRequestBody as u, type GraphQLParsedOperationsMap as v, type ParsedGraphQLQuery as w, parseDocumentNode as x, parseGraphQLRequest as y, type DocumentTypeDecoration as z };
|
|
@@ -368,4 +368,4 @@ declare class HttpResponse<BodyType extends DefaultBodyType> extends FetchRespon
|
|
|
368
368
|
static formData(body?: FormData, init?: HttpResponseInit): HttpResponse<FormData>;
|
|
369
369
|
}
|
|
370
370
|
|
|
371
|
-
export { type AsyncResponseResolverReturnType as A, type
|
|
371
|
+
export { type AsyncResponseResolverReturnType as A, type GraphQLCustomPredicateResult as B, type GraphQLHandlerInfo as C, type DefaultBodyType as D, type GraphQLHandlerNameSelector as E, type GraphQLRequestParsedResult as F, type GraphQLCustomPredicate as G, HttpResponse as H, isDocumentNode as I, type JsonBodyType as J, type RequestHandlerArgs as K, type RequestHandlerExecutionResult as L, type MaybeAsyncResponseResolverReturnType as M, type RequestHandlerInternalInfo as N, forwardResponseCookies as O, type ParsedGraphQLRequest as P, type DefaultUnsafeFetchResponse as Q, RequestHandler as R, type StrictRequest as S, bodyType as T, kDefaultContentType as U, type DefaultRequestMultipartBody as a, GraphQLHandler as b, type GraphQLJsonRequestBody as c, type GraphQLOperationType as d, type GraphQLQuery as e, type GraphQLRequestBody as f, type GraphQLResponseBody as g, type GraphQLVariables as h, type HttpResponseInit as i, type RequestHandlerOptions as j, type ResponseResolutionContext as k, type ResponseResolver as l, type ResponseResolverInfo as m, type ResponseResolverReturnType as n, type StrictResponse as o, type GraphQLPredicate as p, type GraphQLResolverExtras as q, type RequestHandlerDefaultInfo as r, type HandlersExecutionResult as s, executeHandlers as t, type GraphQLMultipartRequestBody as u, type GraphQLParsedOperationsMap as v, type ParsedGraphQLQuery as w, parseDocumentNode as x, parseGraphQLRequest as y, type DocumentTypeDecoration as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '@mswjs/interceptors';
|
|
2
|
-
export {
|
|
2
|
+
export { Q as DefaultUnsafeFetchResponse, H as HttpResponse, i as HttpResponseInit, S as StrictRequest, o as StrictResponse, T as bodyType, U as kDefaultContentType } from './HttpResponse-BTyqrRB6.mjs';
|
|
3
3
|
import './typeUtils.mjs';
|
|
4
4
|
import './utils/internal/isIterable.mjs';
|
|
5
5
|
import 'graphql';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '@mswjs/interceptors';
|
|
2
|
-
export {
|
|
2
|
+
export { Q as DefaultUnsafeFetchResponse, H as HttpResponse, i as HttpResponseInit, S as StrictRequest, o as StrictResponse, T as bodyType, U as kDefaultContentType } from './HttpResponse-BXyXQFMJ.js';
|
|
3
3
|
import './typeUtils.js';
|
|
4
4
|
import './utils/internal/isIterable.js';
|
|
5
5
|
import 'graphql';
|
package/lib/core/HttpResponse.js
CHANGED
|
@@ -25,8 +25,8 @@ __export(HttpResponse_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(HttpResponse_exports);
|
|
26
26
|
var import_interceptors = require("@mswjs/interceptors");
|
|
27
27
|
var import_decorators = require("./utils/HttpResponse/decorators");
|
|
28
|
-
const bodyType = Symbol("bodyType");
|
|
29
|
-
const kDefaultContentType = Symbol.for("kDefaultContentType");
|
|
28
|
+
const bodyType = /* @__PURE__ */ Symbol("bodyType");
|
|
29
|
+
const kDefaultContentType = /* @__PURE__ */ Symbol.for("kDefaultContentType");
|
|
30
30
|
class HttpResponse extends import_interceptors.FetchResponse {
|
|
31
31
|
[bodyType] = null;
|
|
32
32
|
constructor(body, init) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/HttpResponse.ts"],"sourcesContent":["import { FetchResponse } from '@mswjs/interceptors'\nimport type { DefaultBodyType, JsonBodyType } from './handlers/RequestHandler'\nimport type { NoInfer } from './typeUtils'\nimport {\n decorateResponse,\n normalizeResponseInit,\n} from './utils/HttpResponse/decorators'\n\nexport interface HttpResponseInit extends ResponseInit {\n type?: ResponseType\n}\n\nexport const bodyType: unique symbol = Symbol('bodyType')\nexport type DefaultUnsafeFetchResponse = Response & {\n [bodyType]?: never\n}\n\nexport interface StrictRequest<BodyType extends JsonBodyType> extends Request {\n json(): Promise<BodyType>\n clone(): StrictRequest<BodyType>\n}\n\n/**\n * Opaque `Response` type that supports strict body type.\n *\n * @deprecated Please use {@link HttpResponse} instead.\n */\nexport type StrictResponse<BodyType extends DefaultBodyType> =\n HttpResponse<BodyType>\n\nexport const kDefaultContentType = Symbol.for('kDefaultContentType')\n\n/**\n * A drop-in replacement for the standard `Response` class\n * to allow additional features, like mocking the response `Set-Cookie` header.\n *\n * @example\n * new HttpResponse('Hello world', { status: 201 })\n * HttpResponse.json({ name: 'John' })\n * HttpResponse.formData(form)\n *\n * @see {@link https://mswjs.io/docs/api/http-response `HttpResponse` API reference}\n */\nexport class HttpResponse<\n BodyType extends DefaultBodyType,\n> extends FetchResponse {\n readonly [bodyType]: BodyType = null as any\n\n constructor(body?: NoInfer<BodyType> | null, init?: HttpResponseInit) {\n const responseInit = normalizeResponseInit(init)\n super(body as BodyInit, responseInit)\n decorateResponse(this, responseInit)\n }\n\n static error(): HttpResponse<any> {\n return super.error() as HttpResponse<any>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"text/plain\"` body.\n * @example\n * HttpResponse.text('hello world')\n * HttpResponse.text('Error', { status: 500 })\n */\n static text<BodyType extends string>(\n body?: NoInfer<BodyType> | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/plain')\n }\n\n // Automatically set the \"Content-Length\" response header\n // for non-empty text responses. This enforces consistency and\n // brings mocked responses closer to production.\n if (!responseInit.headers.has('Content-Length')) {\n responseInit.headers.set(\n 'Content-Length',\n body ? new Blob([body]).size.toString() : '0',\n )\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"application/json\"` body.\n * @example\n * HttpResponse.json({ firstName: 'John' })\n * HttpResponse.json({ error: 'Not Authorized' }, { status: 401 })\n */\n static json<BodyType extends JsonBodyType>(\n body?: NoInfer<BodyType> | null | undefined,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'application/json')\n }\n\n /**\n * @note TypeScript is incorrect here.\n * Stringifying undefined will return undefined.\n */\n const responseText = JSON.stringify(body) as string | undefined\n\n if (!responseInit.headers.has('Content-Length')) {\n responseInit.headers.set(\n 'Content-Length',\n responseText ? new Blob([responseText]).size.toString() : '0',\n )\n }\n\n const response = new HttpResponse(responseText, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"application/xml\"` body.\n * @example\n * HttpResponse.xml(`<user name=\"John\" />`)\n * HttpResponse.xml(`<article id=\"abc-123\" />`, { status: 201 })\n */\n static xml<BodyType extends string>(\n body?: BodyType | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/xml')\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"text/html\"` body.\n * @example\n * HttpResponse.html(`<p class=\"author\">Jane Doe</p>`)\n * HttpResponse.html(`<main id=\"abc-123\">Main text</main>`, { status: 201 })\n */\n static html<BodyType extends string>(\n body?: BodyType | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/html')\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with an `ArrayBuffer` body.\n * @example\n * const buffer = new ArrayBuffer(3)\n * const view = new Uint8Array(buffer)\n * view.set([1, 2, 3])\n *\n * HttpResponse.arrayBuffer(buffer)\n */\n static arrayBuffer<BodyType extends ArrayBuffer | SharedArrayBuffer>(\n body?: BodyType,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'application/octet-stream')\n }\n\n if (body && !responseInit.headers.has('Content-Length')) {\n responseInit.headers.set('Content-Length', body.byteLength.toString())\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `FormData` body.\n * @example\n * const data = new FormData()\n * data.set('name', 'Alice')\n *\n * HttpResponse.formData(data)\n */\n static formData(\n body?: FormData,\n init?: HttpResponseInit,\n ): HttpResponse<FormData> {\n return new HttpResponse(body, normalizeResponseInit(init))\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA8B;AAG9B,wBAGO;AAMA,MAAM,WAA0B,OAAO,UAAU;AAkBjD,MAAM,sBAAsB,OAAO,IAAI,qBAAqB;AAa5D,MAAM,qBAEH,kCAAc;AAAA,EACtB,CAAU,QAAQ,IAAc;AAAA,EAEhC,YAAY,MAAiC,MAAyB;AACpE,UAAM,mBAAe,yCAAsB,IAAI;AAC/C,UAAM,MAAkB,YAAY;AACpC,4CAAiB,MAAM,YAAY;AAAA,EACrC;AAAA,EAEA,OAAO,QAA2B;AAChC,WAAO,MAAM,MAAM;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAO,KACL,MACA,MACwB;AACxB,UAAM,mBAAe,yCAAsB,IAAI;AAC/C,UAAM,yBAAyB,aAAa,QAAQ,IAAI,cAAc;AAEtE,QAAI,CAAC,wBAAwB;AAC3B,mBAAa,QAAQ,IAAI,gBAAgB,YAAY;AAAA,IACvD;AAKA,QAAI,CAAC,aAAa,QAAQ,IAAI,gBAAgB,GAAG;AAC/C,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,aAAa,UAAM,yCAAsB,IAAI,CAAC;AAAA,EAC3D;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/core/HttpResponse.ts"],"sourcesContent":["import { FetchResponse } from '@mswjs/interceptors'\nimport type { DefaultBodyType, JsonBodyType } from './handlers/RequestHandler'\nimport type { NoInfer } from './typeUtils'\nimport {\n decorateResponse,\n normalizeResponseInit,\n} from './utils/HttpResponse/decorators'\n\nexport interface HttpResponseInit extends ResponseInit {\n type?: ResponseType\n}\n\nexport const bodyType: unique symbol = Symbol('bodyType')\nexport type DefaultUnsafeFetchResponse = Response & {\n [bodyType]?: never\n}\n\nexport interface StrictRequest<BodyType extends JsonBodyType> extends Request {\n json(): Promise<BodyType>\n clone(): StrictRequest<BodyType>\n}\n\n/**\n * Opaque `Response` type that supports strict body type.\n *\n * @deprecated Please use {@link HttpResponse} instead.\n */\nexport type StrictResponse<BodyType extends DefaultBodyType> =\n HttpResponse<BodyType>\n\nexport const kDefaultContentType = Symbol.for('kDefaultContentType')\n\n/**\n * A drop-in replacement for the standard `Response` class\n * to allow additional features, like mocking the response `Set-Cookie` header.\n *\n * @example\n * new HttpResponse('Hello world', { status: 201 })\n * HttpResponse.json({ name: 'John' })\n * HttpResponse.formData(form)\n *\n * @see {@link https://mswjs.io/docs/api/http-response `HttpResponse` API reference}\n */\nexport class HttpResponse<\n BodyType extends DefaultBodyType,\n> extends FetchResponse {\n readonly [bodyType]: BodyType = null as any\n\n constructor(body?: NoInfer<BodyType> | null, init?: HttpResponseInit) {\n const responseInit = normalizeResponseInit(init)\n super(body as BodyInit, responseInit)\n decorateResponse(this, responseInit)\n }\n\n static error(): HttpResponse<any> {\n return super.error() as HttpResponse<any>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"text/plain\"` body.\n * @example\n * HttpResponse.text('hello world')\n * HttpResponse.text('Error', { status: 500 })\n */\n static text<BodyType extends string>(\n body?: NoInfer<BodyType> | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/plain')\n }\n\n // Automatically set the \"Content-Length\" response header\n // for non-empty text responses. This enforces consistency and\n // brings mocked responses closer to production.\n if (!responseInit.headers.has('Content-Length')) {\n responseInit.headers.set(\n 'Content-Length',\n body ? new Blob([body]).size.toString() : '0',\n )\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"application/json\"` body.\n * @example\n * HttpResponse.json({ firstName: 'John' })\n * HttpResponse.json({ error: 'Not Authorized' }, { status: 401 })\n */\n static json<BodyType extends JsonBodyType>(\n body?: NoInfer<BodyType> | null | undefined,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'application/json')\n }\n\n /**\n * @note TypeScript is incorrect here.\n * Stringifying undefined will return undefined.\n */\n const responseText = JSON.stringify(body) as string | undefined\n\n if (!responseInit.headers.has('Content-Length')) {\n responseInit.headers.set(\n 'Content-Length',\n responseText ? new Blob([responseText]).size.toString() : '0',\n )\n }\n\n const response = new HttpResponse(responseText, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"application/xml\"` body.\n * @example\n * HttpResponse.xml(`<user name=\"John\" />`)\n * HttpResponse.xml(`<article id=\"abc-123\" />`, { status: 201 })\n */\n static xml<BodyType extends string>(\n body?: BodyType | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/xml')\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"text/html\"` body.\n * @example\n * HttpResponse.html(`<p class=\"author\">Jane Doe</p>`)\n * HttpResponse.html(`<main id=\"abc-123\">Main text</main>`, { status: 201 })\n */\n static html<BodyType extends string>(\n body?: BodyType | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/html')\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with an `ArrayBuffer` body.\n * @example\n * const buffer = new ArrayBuffer(3)\n * const view = new Uint8Array(buffer)\n * view.set([1, 2, 3])\n *\n * HttpResponse.arrayBuffer(buffer)\n */\n static arrayBuffer<BodyType extends ArrayBuffer | SharedArrayBuffer>(\n body?: BodyType,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'application/octet-stream')\n }\n\n if (body && !responseInit.headers.has('Content-Length')) {\n responseInit.headers.set('Content-Length', body.byteLength.toString())\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `FormData` body.\n * @example\n * const data = new FormData()\n * data.set('name', 'Alice')\n *\n * HttpResponse.formData(data)\n */\n static formData(\n body?: FormData,\n init?: HttpResponseInit,\n ): HttpResponse<FormData> {\n return new HttpResponse(body, normalizeResponseInit(init))\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA8B;AAG9B,wBAGO;AAMA,MAAM,WAA0B,uBAAO,UAAU;AAkBjD,MAAM,sBAAsB,uBAAO,IAAI,qBAAqB;AAa5D,MAAM,qBAEH,kCAAc;AAAA,EACtB,CAAU,QAAQ,IAAc;AAAA,EAEhC,YAAY,MAAiC,MAAyB;AACpE,UAAM,mBAAe,yCAAsB,IAAI;AAC/C,UAAM,MAAkB,YAAY;AACpC,4CAAiB,MAAM,YAAY;AAAA,EACrC;AAAA,EAEA,OAAO,QAA2B;AAChC,WAAO,MAAM,MAAM;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAO,KACL,MACA,MACwB;AACxB,UAAM,mBAAe,yCAAsB,IAAI;AAC/C,UAAM,yBAAyB,aAAa,QAAQ,IAAI,cAAc;AAEtE,QAAI,CAAC,wBAAwB;AAC3B,mBAAa,QAAQ,IAAI,gBAAgB,YAAY;AAAA,IACvD;AAKA,QAAI,CAAC,aAAa,QAAQ,IAAI,gBAAgB,GAAG;AAC/C,mBAAa,QAAQ;AAAA,QACnB;AAAA,QACA,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,SAAS,IAAI;AAAA,MAC5C;AAAA,IACF;AAEA,UAAM,WAAW,IAAI,aAAa,MAAM,YAAY;AAEpD,QAAI,CAAC,wBAAwB;AAC3B,aAAO,eAAe,UAAU,qBAAqB;AAAA,QACnD,OAAO;AAAA,QACP,YAAY;AAAA,MACd,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;A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AAI,gBAAgB,WAAW;AAAA,IACtD;AAEA,UAAM,WAAW,IAAI,aAAa,MAAM,YAAY;AAEpD,QAAI,CAAC,wBAAwB;AAC3B,aAAO,eAAe,UAAU,qBAAqB;AAAA,QACnD,OAAO;AAAA,QACP,YAAY;AAAA,MACd,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,OAAO,YACL,MACA,MACwB;AACxB,UAAM,mBAAe,yCAAsB,IAAI;AAC/C,UAAM,yBAAyB,aAAa,QAAQ,IAAI,cAAc;AAEtE,QAAI,CAAC,wBAAwB;AAC3B,mBAAa,QAAQ,IAAI,gBAAgB,0BAA0B;AAAA,IACrE;AAEA,QAAI,QAAQ,CAAC,aAAa,QAAQ,IAAI,gBAAgB,GAAG;AACvD,mBAAa,QAAQ,IAAI,kBAAkB,KAAK,WAAW,SAAS,CAAC;AAAA,IACvE;AAEA,UAAM,WAAW,IAAI,aAAa,MAAM,YAAY;AAEpD,QAAI,CAAC,wBAAwB;AAC3B,aAAO,eAAe,UAAU,qBAAqB;AAAA,QACnD,OAAO;AAAA,QACP,YAAY;AAAA,MACd,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,OAAO,SACL,MACA,MACwB;AACxB,WAAO,IAAI,aAAa,UAAM,yCAAsB,IAAI,CAAC;AAAA,EAC3D;AACF;","names":[]}
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
decorateResponse,
|
|
4
4
|
normalizeResponseInit
|
|
5
5
|
} from './utils/HttpResponse/decorators.mjs';
|
|
6
|
-
const bodyType = Symbol("bodyType");
|
|
7
|
-
const kDefaultContentType = Symbol.for("kDefaultContentType");
|
|
6
|
+
const bodyType = /* @__PURE__ */ Symbol("bodyType");
|
|
7
|
+
const kDefaultContentType = /* @__PURE__ */ Symbol.for("kDefaultContentType");
|
|
8
8
|
class HttpResponse extends FetchResponse {
|
|
9
9
|
[bodyType] = null;
|
|
10
10
|
constructor(body, init) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/HttpResponse.ts"],"sourcesContent":["import { FetchResponse } from '@mswjs/interceptors'\nimport type { DefaultBodyType, JsonBodyType } from './handlers/RequestHandler'\nimport type { NoInfer } from './typeUtils'\nimport {\n decorateResponse,\n normalizeResponseInit,\n} from './utils/HttpResponse/decorators'\n\nexport interface HttpResponseInit extends ResponseInit {\n type?: ResponseType\n}\n\nexport const bodyType: unique symbol = Symbol('bodyType')\nexport type DefaultUnsafeFetchResponse = Response & {\n [bodyType]?: never\n}\n\nexport interface StrictRequest<BodyType extends JsonBodyType> extends Request {\n json(): Promise<BodyType>\n clone(): StrictRequest<BodyType>\n}\n\n/**\n * Opaque `Response` type that supports strict body type.\n *\n * @deprecated Please use {@link HttpResponse} instead.\n */\nexport type StrictResponse<BodyType extends DefaultBodyType> =\n HttpResponse<BodyType>\n\nexport const kDefaultContentType = Symbol.for('kDefaultContentType')\n\n/**\n * A drop-in replacement for the standard `Response` class\n * to allow additional features, like mocking the response `Set-Cookie` header.\n *\n * @example\n * new HttpResponse('Hello world', { status: 201 })\n * HttpResponse.json({ name: 'John' })\n * HttpResponse.formData(form)\n *\n * @see {@link https://mswjs.io/docs/api/http-response `HttpResponse` API reference}\n */\nexport class HttpResponse<\n BodyType extends DefaultBodyType,\n> extends FetchResponse {\n readonly [bodyType]: BodyType = null as any\n\n constructor(body?: NoInfer<BodyType> | null, init?: HttpResponseInit) {\n const responseInit = normalizeResponseInit(init)\n super(body as BodyInit, responseInit)\n decorateResponse(this, responseInit)\n }\n\n static error(): HttpResponse<any> {\n return super.error() as HttpResponse<any>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"text/plain\"` body.\n * @example\n * HttpResponse.text('hello world')\n * HttpResponse.text('Error', { status: 500 })\n */\n static text<BodyType extends string>(\n body?: NoInfer<BodyType> | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/plain')\n }\n\n // Automatically set the \"Content-Length\" response header\n // for non-empty text responses. This enforces consistency and\n // brings mocked responses closer to production.\n if (!responseInit.headers.has('Content-Length')) {\n responseInit.headers.set(\n 'Content-Length',\n body ? new Blob([body]).size.toString() : '0',\n )\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"application/json\"` body.\n * @example\n * HttpResponse.json({ firstName: 'John' })\n * HttpResponse.json({ error: 'Not Authorized' }, { status: 401 })\n */\n static json<BodyType extends JsonBodyType>(\n body?: NoInfer<BodyType> | null | undefined,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'application/json')\n }\n\n /**\n * @note TypeScript is incorrect here.\n * Stringifying undefined will return undefined.\n */\n const responseText = JSON.stringify(body) as string | undefined\n\n if (!responseInit.headers.has('Content-Length')) {\n responseInit.headers.set(\n 'Content-Length',\n responseText ? new Blob([responseText]).size.toString() : '0',\n )\n }\n\n const response = new HttpResponse(responseText, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"application/xml\"` body.\n * @example\n * HttpResponse.xml(`<user name=\"John\" />`)\n * HttpResponse.xml(`<article id=\"abc-123\" />`, { status: 201 })\n */\n static xml<BodyType extends string>(\n body?: BodyType | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/xml')\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"text/html\"` body.\n * @example\n * HttpResponse.html(`<p class=\"author\">Jane Doe</p>`)\n * HttpResponse.html(`<main id=\"abc-123\">Main text</main>`, { status: 201 })\n */\n static html<BodyType extends string>(\n body?: BodyType | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/html')\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with an `ArrayBuffer` body.\n * @example\n * const buffer = new ArrayBuffer(3)\n * const view = new Uint8Array(buffer)\n * view.set([1, 2, 3])\n *\n * HttpResponse.arrayBuffer(buffer)\n */\n static arrayBuffer<BodyType extends ArrayBuffer | SharedArrayBuffer>(\n body?: BodyType,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'application/octet-stream')\n }\n\n if (body && !responseInit.headers.has('Content-Length')) {\n responseInit.headers.set('Content-Length', body.byteLength.toString())\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `FormData` body.\n * @example\n * const data = new FormData()\n * data.set('name', 'Alice')\n *\n * HttpResponse.formData(data)\n */\n static formData(\n body?: FormData,\n init?: HttpResponseInit,\n ): HttpResponse<FormData> {\n return new HttpResponse(body, normalizeResponseInit(init))\n }\n}\n"],"mappings":"AAAA,SAAS,qBAAqB;AAG9B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAMA,MAAM,WAA0B,OAAO,UAAU;AAkBjD,MAAM,sBAAsB,OAAO,IAAI,qBAAqB;AAa5D,MAAM,qBAEH,cAAc;AAAA,EACtB,CAAU,QAAQ,IAAc;AAAA,EAEhC,YAAY,MAAiC,MAAyB;AACpE,UAAM,eAAe,sBAAsB,IAAI;AAC/C,UAAM,MAAkB,YAAY;AACpC,qBAAiB,MAAM,YAAY;AAAA,EACrC;AAAA,EAEA,OAAO,QAA2B;AAChC,WAAO,MAAM,MAAM;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAO,KACL,MACA,MACwB;AACxB,UAAM,eAAe,sBAAsB,IAAI;AAC/C,UAAM,yBAAyB,aAAa,QAAQ,IAAI,cAAc;AAEtE,QAAI,CAAC,wBAAwB;AAC3B,mBAAa,QAAQ,IAAI,gBAAgB,YAAY;AAAA,IACvD;AAKA,QAAI,CAAC,aAAa,QAAQ,IAAI,gBAAgB,GAAG;AAC/C,mBAAa,QAAQ;AAAA,QACnB;AAAA,QACA,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,SAAS,IAAI;AAAA,MAC5C;AAAA,IACF;AAEA,UAAM,WAAW,IAAI,aAAa,MAAM,YAAY;AAEpD,QAAI,CAAC,wBAAwB;AAC3B,aAAO,eAAe,UAAU,qBAAqB;AAAA,QACnD,OAAO;AAAA,QACP,YAAY;AAAA,MACd,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;A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BAAa,QAAQ,IAAI,gBAAgB,WAAW;AAAA,IACtD;AAEA,UAAM,WAAW,IAAI,aAAa,MAAM,YAAY;AAEpD,QAAI,CAAC,wBAAwB;AAC3B,aAAO,eAAe,UAAU,qBAAqB;AAAA,QACnD,OAAO;AAAA,QACP,YAAY;AAAA,MACd,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,OAAO,YACL,MACA,MACwB;AACxB,UAAM,eAAe,sBAAsB,IAAI;AAC/C,UAAM,yBAAyB,aAAa,QAAQ,IAAI,cAAc;AAEtE,QAAI,CAAC,wBAAwB;AAC3B,mBAAa,QAAQ,IAAI,gBAAgB,0BAA0B;AAAA,IACrE;AAEA,QAAI,QAAQ,CAAC,aAAa,QAAQ,IAAI,gBAAgB,GAAG;AACvD,mBAAa,QAAQ,IAAI,kBAAkB,KAAK,WAAW,SAAS,CAAC;AAAA,IACvE;AAEA,UAAM,WAAW,IAAI,aAAa,MAAM,YAAY;AAEpD,QAAI,CAAC,wBAAwB;AAC3B,aAAO,eAAe,UAAU,qBAAqB;AAAA,QACnD,OAAO;AAAA,QACP,YAAY;AAAA,MACd,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,OAAO,SACL,MACA,MACwB;AACxB,WAAO,IAAI,aAAa,MAAM,sBAAsB,IAAI,CAAC;AAAA,EAC3D;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/core/HttpResponse.ts"],"sourcesContent":["import { FetchResponse } from '@mswjs/interceptors'\nimport type { DefaultBodyType, JsonBodyType } from './handlers/RequestHandler'\nimport type { NoInfer } from './typeUtils'\nimport {\n decorateResponse,\n normalizeResponseInit,\n} from './utils/HttpResponse/decorators'\n\nexport interface HttpResponseInit extends ResponseInit {\n type?: ResponseType\n}\n\nexport const bodyType: unique symbol = Symbol('bodyType')\nexport type DefaultUnsafeFetchResponse = Response & {\n [bodyType]?: never\n}\n\nexport interface StrictRequest<BodyType extends JsonBodyType> extends Request {\n json(): Promise<BodyType>\n clone(): StrictRequest<BodyType>\n}\n\n/**\n * Opaque `Response` type that supports strict body type.\n *\n * @deprecated Please use {@link HttpResponse} instead.\n */\nexport type StrictResponse<BodyType extends DefaultBodyType> =\n HttpResponse<BodyType>\n\nexport const kDefaultContentType = Symbol.for('kDefaultContentType')\n\n/**\n * A drop-in replacement for the standard `Response` class\n * to allow additional features, like mocking the response `Set-Cookie` header.\n *\n * @example\n * new HttpResponse('Hello world', { status: 201 })\n * HttpResponse.json({ name: 'John' })\n * HttpResponse.formData(form)\n *\n * @see {@link https://mswjs.io/docs/api/http-response `HttpResponse` API reference}\n */\nexport class HttpResponse<\n BodyType extends DefaultBodyType,\n> extends FetchResponse {\n readonly [bodyType]: BodyType = null as any\n\n constructor(body?: NoInfer<BodyType> | null, init?: HttpResponseInit) {\n const responseInit = normalizeResponseInit(init)\n super(body as BodyInit, responseInit)\n decorateResponse(this, responseInit)\n }\n\n static error(): HttpResponse<any> {\n return super.error() as HttpResponse<any>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"text/plain\"` body.\n * @example\n * HttpResponse.text('hello world')\n * HttpResponse.text('Error', { status: 500 })\n */\n static text<BodyType extends string>(\n body?: NoInfer<BodyType> | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/plain')\n }\n\n // Automatically set the \"Content-Length\" response header\n // for non-empty text responses. This enforces consistency and\n // brings mocked responses closer to production.\n if (!responseInit.headers.has('Content-Length')) {\n responseInit.headers.set(\n 'Content-Length',\n body ? new Blob([body]).size.toString() : '0',\n )\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"application/json\"` body.\n * @example\n * HttpResponse.json({ firstName: 'John' })\n * HttpResponse.json({ error: 'Not Authorized' }, { status: 401 })\n */\n static json<BodyType extends JsonBodyType>(\n body?: NoInfer<BodyType> | null | undefined,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'application/json')\n }\n\n /**\n * @note TypeScript is incorrect here.\n * Stringifying undefined will return undefined.\n */\n const responseText = JSON.stringify(body) as string | undefined\n\n if (!responseInit.headers.has('Content-Length')) {\n responseInit.headers.set(\n 'Content-Length',\n responseText ? new Blob([responseText]).size.toString() : '0',\n )\n }\n\n const response = new HttpResponse(responseText, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"application/xml\"` body.\n * @example\n * HttpResponse.xml(`<user name=\"John\" />`)\n * HttpResponse.xml(`<article id=\"abc-123\" />`, { status: 201 })\n */\n static xml<BodyType extends string>(\n body?: BodyType | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/xml')\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"text/html\"` body.\n * @example\n * HttpResponse.html(`<p class=\"author\">Jane Doe</p>`)\n * HttpResponse.html(`<main id=\"abc-123\">Main text</main>`, { status: 201 })\n */\n static html<BodyType extends string>(\n body?: BodyType | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/html')\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with an `ArrayBuffer` body.\n * @example\n * const buffer = new ArrayBuffer(3)\n * const view = new Uint8Array(buffer)\n * view.set([1, 2, 3])\n *\n * HttpResponse.arrayBuffer(buffer)\n */\n static arrayBuffer<BodyType extends ArrayBuffer | SharedArrayBuffer>(\n body?: BodyType,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'application/octet-stream')\n }\n\n if (body && !responseInit.headers.has('Content-Length')) {\n responseInit.headers.set('Content-Length', body.byteLength.toString())\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `FormData` body.\n * @example\n * const data = new FormData()\n * data.set('name', 'Alice')\n *\n * HttpResponse.formData(data)\n */\n static formData(\n body?: FormData,\n init?: HttpResponseInit,\n ): HttpResponse<FormData> {\n return new HttpResponse(body, normalizeResponseInit(init))\n }\n}\n"],"mappings":"AAAA,SAAS,qBAAqB;AAG9B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAMA,MAAM,WAA0B,uBAAO,UAAU;AAkBjD,MAAM,sBAAsB,uBAAO,IAAI,qBAAqB;AAa5D,MAAM,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,QAAQ,IAAI,cAAc;AAEtE,QAAI,CAAC,wBAAwB;AAC3B,mBAAa,QAAQ,IAAI,gBAAgB,0BAA0B;AAAA,IACrE;AAEA,QAAI,QAAQ,CAAC,aAAa,QAAQ,IAAI,gBAAgB,GAAG;AACvD,mBAAa,QAAQ,IAAI,kBAAkB,KAAK,WAAW,SAAS,CAAC;AAAA,IACvE;AAEA,UAAM,WAAW,IAAI,aAAa,MAAM,YAAY;AAEpD,QAAI,CAAC,wBAAwB;AAC3B,aAAO,eAAe,UAAU,qBAAqB;AAAA,QACnD,OAAO;AAAA,QACP,YAAY;AAAA,MACd,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,OAAO,SACL,MACA,MACwB;AACxB,WAAO,IAAI,aAAa,MAAM,sBAAsB,IAAI,CAAC;AAAA,EAC3D;AACF;","names":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { UnhandledRequestStrategy } from '../utils/request/onUnhandledRequest.mjs';
|
|
2
|
-
import { U as UnhandledFrameCallback } from '../on-unhandled-frame-
|
|
2
|
+
import { U as UnhandledFrameCallback } from '../on-unhandled-frame-gkokW4Rr.mjs';
|
|
3
3
|
import 'rettime';
|
|
4
4
|
import './handlers-controller.mjs';
|
|
5
|
-
import '../HttpResponse-
|
|
5
|
+
import '../HttpResponse-BTyqrRB6.mjs';
|
|
6
6
|
import '@mswjs/interceptors';
|
|
7
7
|
import '../utils/internal/isIterable.mjs';
|
|
8
8
|
import '../typeUtils.mjs';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { UnhandledRequestStrategy } from '../utils/request/onUnhandledRequest.js';
|
|
2
|
-
import { U as UnhandledFrameCallback } from '../on-unhandled-frame-
|
|
2
|
+
import { U as UnhandledFrameCallback } from '../on-unhandled-frame-0KmwUmeV.js';
|
|
3
3
|
import 'rettime';
|
|
4
4
|
import './handlers-controller.js';
|
|
5
|
-
import '../HttpResponse-
|
|
5
|
+
import '../HttpResponse-BXyXQFMJ.js';
|
|
6
6
|
import '@mswjs/interceptors';
|
|
7
7
|
import '../utils/internal/isIterable.js';
|
|
8
8
|
import '../typeUtils.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Emitter, DefaultEventMap } from 'rettime';
|
|
2
2
|
import { NetworkSource, ExtractSourceEvents } from './sources/network-source.mjs';
|
|
3
|
-
import { a as NetworkFrameResolutionContext, b as UnhandledFrameHandle } from '../on-unhandled-frame-
|
|
3
|
+
import { a as NetworkFrameResolutionContext, b as UnhandledFrameHandle } from '../on-unhandled-frame-gkokW4Rr.mjs';
|
|
4
4
|
import { AnyHandler, HandlersController } from './handlers-controller.mjs';
|
|
5
|
-
import '../HttpResponse-
|
|
5
|
+
import '../HttpResponse-BTyqrRB6.mjs';
|
|
6
6
|
import '@mswjs/interceptors';
|
|
7
7
|
import '../utils/internal/isIterable.mjs';
|
|
8
8
|
import '../typeUtils.mjs';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Emitter, DefaultEventMap } from 'rettime';
|
|
2
2
|
import { NetworkSource, ExtractSourceEvents } from './sources/network-source.js';
|
|
3
|
-
import { a as NetworkFrameResolutionContext, b as UnhandledFrameHandle } from '../on-unhandled-frame-
|
|
3
|
+
import { a as NetworkFrameResolutionContext, b as UnhandledFrameHandle } from '../on-unhandled-frame-0KmwUmeV.js';
|
|
4
4
|
import { AnyHandler, HandlersController } from './handlers-controller.js';
|
|
5
|
-
import '../HttpResponse-
|
|
5
|
+
import '../HttpResponse-BXyXQFMJ.js';
|
|
6
6
|
import '@mswjs/interceptors';
|
|
7
7
|
import '../utils/internal/isIterable.js';
|
|
8
8
|
import '../typeUtils.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TypedEvent } from 'rettime';
|
|
2
|
-
import { N as NetworkFrame, b as UnhandledFrameHandle, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-
|
|
2
|
+
import { N as NetworkFrame, b as UnhandledFrameHandle, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-gkokW4Rr.mjs';
|
|
3
3
|
import { HandlersController, AnyHandler } from '../handlers-controller.mjs';
|
|
4
|
-
import { R as RequestHandler } from '../../HttpResponse-
|
|
4
|
+
import { R as RequestHandler } from '../../HttpResponse-BTyqrRB6.mjs';
|
|
5
5
|
import '../../handlers/WebSocketHandler.mjs';
|
|
6
6
|
import 'strict-event-emitter';
|
|
7
7
|
import '@mswjs/interceptors/WebSocket';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TypedEvent } from 'rettime';
|
|
2
|
-
import { N as NetworkFrame, b as UnhandledFrameHandle, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-
|
|
2
|
+
import { N as NetworkFrame, b as UnhandledFrameHandle, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-0KmwUmeV.js';
|
|
3
3
|
import { HandlersController, AnyHandler } from '../handlers-controller.js';
|
|
4
|
-
import { R as RequestHandler } from '../../HttpResponse-
|
|
4
|
+
import { R as RequestHandler } from '../../HttpResponse-BXyXQFMJ.js';
|
|
5
5
|
import '../../handlers/WebSocketHandler.js';
|
|
6
6
|
import 'strict-event-emitter';
|
|
7
7
|
import '@mswjs/interceptors/WebSocket';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'rettime';
|
|
2
2
|
import '../handlers-controller.mjs';
|
|
3
|
-
export { A as AnyNetworkFrame, E as ExtractFrameEvents, N as NetworkFrame, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-
|
|
4
|
-
import '../../HttpResponse-
|
|
3
|
+
export { A as AnyNetworkFrame, E as ExtractFrameEvents, N as NetworkFrame, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-gkokW4Rr.mjs';
|
|
4
|
+
import '../../HttpResponse-BTyqrRB6.mjs';
|
|
5
5
|
import '@mswjs/interceptors';
|
|
6
6
|
import '../../utils/internal/isIterable.mjs';
|
|
7
7
|
import '../../typeUtils.mjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'rettime';
|
|
2
2
|
import '../handlers-controller.js';
|
|
3
|
-
export { A as AnyNetworkFrame, E as ExtractFrameEvents, N as NetworkFrame, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-
|
|
4
|
-
import '../../HttpResponse-
|
|
3
|
+
export { A as AnyNetworkFrame, E as ExtractFrameEvents, N as NetworkFrame, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-0KmwUmeV.js';
|
|
4
|
+
import '../../HttpResponse-BXyXQFMJ.js';
|
|
5
5
|
import '@mswjs/interceptors';
|
|
6
6
|
import '../../utils/internal/isIterable.js';
|
|
7
7
|
import '../../typeUtils.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/experimental/frames/network-frame.ts"],"sourcesContent":["import { Emitter, type DefaultEventMap } from 'rettime'\nimport type { AnyHandler, HandlersController } from '../handlers-controller'\nimport type { UnhandledFrameHandle } from '../on-unhandled-frame'\n\nexport type AnyNetworkFrame = NetworkFrame<string, unknown, any>\n\nexport type ExtractFrameEvents<Frame> =\n Frame extends NetworkFrame<any, any, infer Events> ? Events : never\n\nexport interface NetworkFrameResolutionContext {\n baseUrl?: string | URL\n quiet?: boolean\n}\n\n/**\n * The base for the network frames. Extend this abstract class\n * to implement custom network frames.\n */\nexport abstract class NetworkFrame<\n Protocol extends string,\n Data,\n Events extends DefaultEventMap,\n> {\n public events: Emitter<Events>\n\n constructor(\n public readonly protocol: Protocol,\n public readonly data: Data,\n ) {\n this.events = new Emitter()\n }\n\n public abstract getHandlers(controller: HandlersController): Array<AnyHandler>\n\n /**\n * Resolve the current frame against the given list of handlers.\n * Optionally, use a custom resolution context to control behaviors\n * like `baseUrl`.\n *\n * Returns `true` if the frame was handled, `false` if it wasn't, and `null`\n * if its handling was skipped (e.g. the frame was bypassed).\n */\n public abstract resolve(\n handlers: Array<AnyHandler>,\n onUnhandledFrame: UnhandledFrameHandle,\n resolutionContext?: NetworkFrameResolutionContext,\n ): Promise<boolean | null>\n\n /**\n * Perform this network frame as-is.\n */\n public abstract passthrough(): void\n\n /**\n * Error the underling network frame.\n * @param reason The reason for the error.\n */\n public abstract errorWith(reason?: unknown): void\n\n /**\n * Get a message to be used when this frame is unhandled.\n */\n public abstract getUnhandledMessage(): Promise<string>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA8C;AAkBvC,MAAe,aAIpB;AAAA,EAGA,YACkB,UACA,MAChB;AAFgB;AACA;AAEhB,SAAK,SAAS,IAAI,uBAAQ;AAAA,EAC5B;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/experimental/frames/network-frame.ts"],"sourcesContent":["import { Emitter, type DefaultEventMap } from 'rettime'\nimport type { AnyHandler, HandlersController } from '../handlers-controller'\nimport type { UnhandledFrameHandle } from '../on-unhandled-frame'\n\nexport type AnyNetworkFrame = NetworkFrame<string, unknown, any>\n\nexport type ExtractFrameEvents<Frame> =\n Frame extends NetworkFrame<any, any, infer Events> ? Events : never\n\nexport interface NetworkFrameResolutionContext {\n baseUrl?: string | URL\n quiet?: boolean\n}\n\n/**\n * The base for the network frames. Extend this abstract class\n * to implement custom network frames.\n */\nexport abstract class NetworkFrame<\n Protocol extends string,\n Data,\n Events extends DefaultEventMap,\n> {\n public events: Emitter<Events>\n\n constructor(\n public readonly protocol: Protocol,\n public readonly data: Data,\n ) {\n this.events = new Emitter()\n }\n\n public abstract getHandlers(controller: HandlersController): Array<AnyHandler>\n\n /**\n * Resolve the current frame against the given list of handlers.\n * Optionally, use a custom resolution context to control behaviors\n * like `baseUrl`.\n *\n * Returns `true` if the frame was handled, `false` if it wasn't, and `null`\n * if its handling was skipped (e.g. the frame was bypassed).\n */\n public abstract resolve(\n handlers: Array<AnyHandler>,\n onUnhandledFrame: UnhandledFrameHandle,\n resolutionContext?: NetworkFrameResolutionContext,\n ): Promise<boolean | null>\n\n /**\n * Perform this network frame as-is.\n */\n public abstract passthrough(): void\n\n /**\n * Error the underling network frame.\n * @param reason The reason for the error.\n */\n public abstract errorWith(reason?: unknown): void\n\n /**\n * Get a message to be used when this frame is unhandled.\n */\n public abstract getUnhandledMessage(): Promise<string>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA8C;AAkBvC,MAAe,aAIpB;AAAA,EAGA,YACkB,UACA,MAChB;AAFgB;AACA;AAEhB,SAAK,SAAS,IAAI,uBAAQ;AAAA,EAC5B;AAAA,EAJkB;AAAA,EACA;AAAA,EAJX;AAwCT;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/experimental/frames/network-frame.ts"],"sourcesContent":["import { Emitter, type DefaultEventMap } from 'rettime'\nimport type { AnyHandler, HandlersController } from '../handlers-controller'\nimport type { UnhandledFrameHandle } from '../on-unhandled-frame'\n\nexport type AnyNetworkFrame = NetworkFrame<string, unknown, any>\n\nexport type ExtractFrameEvents<Frame> =\n Frame extends NetworkFrame<any, any, infer Events> ? Events : never\n\nexport interface NetworkFrameResolutionContext {\n baseUrl?: string | URL\n quiet?: boolean\n}\n\n/**\n * The base for the network frames. Extend this abstract class\n * to implement custom network frames.\n */\nexport abstract class NetworkFrame<\n Protocol extends string,\n Data,\n Events extends DefaultEventMap,\n> {\n public events: Emitter<Events>\n\n constructor(\n public readonly protocol: Protocol,\n public readonly data: Data,\n ) {\n this.events = new Emitter()\n }\n\n public abstract getHandlers(controller: HandlersController): Array<AnyHandler>\n\n /**\n * Resolve the current frame against the given list of handlers.\n * Optionally, use a custom resolution context to control behaviors\n * like `baseUrl`.\n *\n * Returns `true` if the frame was handled, `false` if it wasn't, and `null`\n * if its handling was skipped (e.g. the frame was bypassed).\n */\n public abstract resolve(\n handlers: Array<AnyHandler>,\n onUnhandledFrame: UnhandledFrameHandle,\n resolutionContext?: NetworkFrameResolutionContext,\n ): Promise<boolean | null>\n\n /**\n * Perform this network frame as-is.\n */\n public abstract passthrough(): void\n\n /**\n * Error the underling network frame.\n * @param reason The reason for the error.\n */\n public abstract errorWith(reason?: unknown): void\n\n /**\n * Get a message to be used when this frame is unhandled.\n */\n public abstract getUnhandledMessage(): Promise<string>\n}\n"],"mappings":"AAAA,SAAS,eAAqC;AAkBvC,MAAe,aAIpB;AAAA,EAGA,YACkB,UACA,MAChB;AAFgB;AACA;AAEhB,SAAK,SAAS,IAAI,QAAQ;AAAA,EAC5B;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/experimental/frames/network-frame.ts"],"sourcesContent":["import { Emitter, type DefaultEventMap } from 'rettime'\nimport type { AnyHandler, HandlersController } from '../handlers-controller'\nimport type { UnhandledFrameHandle } from '../on-unhandled-frame'\n\nexport type AnyNetworkFrame = NetworkFrame<string, unknown, any>\n\nexport type ExtractFrameEvents<Frame> =\n Frame extends NetworkFrame<any, any, infer Events> ? Events : never\n\nexport interface NetworkFrameResolutionContext {\n baseUrl?: string | URL\n quiet?: boolean\n}\n\n/**\n * The base for the network frames. Extend this abstract class\n * to implement custom network frames.\n */\nexport abstract class NetworkFrame<\n Protocol extends string,\n Data,\n Events extends DefaultEventMap,\n> {\n public events: Emitter<Events>\n\n constructor(\n public readonly protocol: Protocol,\n public readonly data: Data,\n ) {\n this.events = new Emitter()\n }\n\n public abstract getHandlers(controller: HandlersController): Array<AnyHandler>\n\n /**\n * Resolve the current frame against the given list of handlers.\n * Optionally, use a custom resolution context to control behaviors\n * like `baseUrl`.\n *\n * Returns `true` if the frame was handled, `false` if it wasn't, and `null`\n * if its handling was skipped (e.g. the frame was bypassed).\n */\n public abstract resolve(\n handlers: Array<AnyHandler>,\n onUnhandledFrame: UnhandledFrameHandle,\n resolutionContext?: NetworkFrameResolutionContext,\n ): Promise<boolean | null>\n\n /**\n * Perform this network frame as-is.\n */\n public abstract passthrough(): void\n\n /**\n * Error the underling network frame.\n * @param reason The reason for the error.\n */\n public abstract errorWith(reason?: unknown): void\n\n /**\n * Get a message to be used when this frame is unhandled.\n */\n public abstract getUnhandledMessage(): Promise<string>\n}\n"],"mappings":"AAAA,SAAS,eAAqC;AAkBvC,MAAe,aAIpB;AAAA,EAGA,YACkB,UACA,MAChB;AAFgB;AACA;AAEhB,SAAK,SAAS,IAAI,QAAQ;AAAA,EAC5B;AAAA,EAJkB;AAAA,EACA;AAAA,EAJX;AAwCT;","names":[]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { TypedEvent } from 'rettime';
|
|
2
2
|
import { WebSocketConnectionData } from '@mswjs/interceptors/WebSocket';
|
|
3
3
|
import { WebSocketHandler } from '../../handlers/WebSocketHandler.mjs';
|
|
4
|
-
import { N as NetworkFrame, b as UnhandledFrameHandle, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-
|
|
4
|
+
import { N as NetworkFrame, b as UnhandledFrameHandle, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-gkokW4Rr.mjs';
|
|
5
5
|
import { HandlersController, AnyHandler } from '../handlers-controller.mjs';
|
|
6
6
|
import 'strict-event-emitter';
|
|
7
7
|
import '../../utils/matching/matchRequestUrl.mjs';
|
|
8
|
-
import '../../HttpResponse-
|
|
8
|
+
import '../../HttpResponse-BTyqrRB6.mjs';
|
|
9
9
|
import '@mswjs/interceptors';
|
|
10
10
|
import '../../utils/internal/isIterable.mjs';
|
|
11
11
|
import '../../typeUtils.mjs';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { TypedEvent } from 'rettime';
|
|
2
2
|
import { WebSocketConnectionData } from '@mswjs/interceptors/WebSocket';
|
|
3
3
|
import { WebSocketHandler } from '../../handlers/WebSocketHandler.js';
|
|
4
|
-
import { N as NetworkFrame, b as UnhandledFrameHandle, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-
|
|
4
|
+
import { N as NetworkFrame, b as UnhandledFrameHandle, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-0KmwUmeV.js';
|
|
5
5
|
import { HandlersController, AnyHandler } from '../handlers-controller.js';
|
|
6
6
|
import 'strict-event-emitter';
|
|
7
7
|
import '../../utils/matching/matchRequestUrl.js';
|
|
8
|
-
import '../../HttpResponse-
|
|
8
|
+
import '../../HttpResponse-BXyXQFMJ.js';
|
|
9
9
|
import '@mswjs/interceptors';
|
|
10
10
|
import '../../utils/internal/isIterable.js';
|
|
11
11
|
import '../../typeUtils.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RequestHandler } from '../HttpResponse-
|
|
1
|
+
import { R as RequestHandler } from '../HttpResponse-BTyqrRB6.mjs';
|
|
2
2
|
import { WebSocketHandler } from '../handlers/WebSocketHandler.mjs';
|
|
3
3
|
import '@mswjs/interceptors';
|
|
4
4
|
import '../utils/internal/isIterable.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RequestHandler } from '../HttpResponse-
|
|
1
|
+
import { R as RequestHandler } from '../HttpResponse-BXyXQFMJ.js';
|
|
2
2
|
import { WebSocketHandler } from '../handlers/WebSocketHandler.js';
|
|
3
3
|
import '@mswjs/interceptors';
|
|
4
4
|
import '../utils/internal/isIterable.js';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export { DefineNetworkOptions, NetworkApi, defineNetwork } from './define-network.mjs';
|
|
2
2
|
export { NetworkSource } from './sources/network-source.mjs';
|
|
3
3
|
export { InterceptorSource } from './sources/interceptor-source.mjs';
|
|
4
|
-
export { N as NetworkFrame } from '../on-unhandled-frame-
|
|
4
|
+
export { N as NetworkFrame } from '../on-unhandled-frame-gkokW4Rr.mjs';
|
|
5
5
|
export { HttpNetworkFrame, HttpNetworkFrameEventMap } from './frames/http-frame.mjs';
|
|
6
6
|
export { WebSocketNetworkFrame, WebSocketNetworkFrameEventMap } from './frames/websocket-frame.mjs';
|
|
7
7
|
export { HandlersController, InMemoryHandlersController } from './handlers-controller.mjs';
|
|
8
8
|
import 'rettime';
|
|
9
9
|
import '@mswjs/interceptors';
|
|
10
10
|
import '@mswjs/interceptors/WebSocket';
|
|
11
|
-
import '../HttpResponse-
|
|
11
|
+
import '../HttpResponse-BTyqrRB6.mjs';
|
|
12
12
|
import '../utils/internal/isIterable.mjs';
|
|
13
13
|
import '../typeUtils.mjs';
|
|
14
14
|
import 'graphql';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export { DefineNetworkOptions, NetworkApi, defineNetwork } from './define-network.js';
|
|
2
2
|
export { NetworkSource } from './sources/network-source.js';
|
|
3
3
|
export { InterceptorSource } from './sources/interceptor-source.js';
|
|
4
|
-
export { N as NetworkFrame } from '../on-unhandled-frame-
|
|
4
|
+
export { N as NetworkFrame } from '../on-unhandled-frame-0KmwUmeV.js';
|
|
5
5
|
export { HttpNetworkFrame, HttpNetworkFrameEventMap } from './frames/http-frame.js';
|
|
6
6
|
export { WebSocketNetworkFrame, WebSocketNetworkFrameEventMap } from './frames/websocket-frame.js';
|
|
7
7
|
export { HandlersController, InMemoryHandlersController } from './handlers-controller.js';
|
|
8
8
|
import 'rettime';
|
|
9
9
|
import '@mswjs/interceptors';
|
|
10
10
|
import '@mswjs/interceptors/WebSocket';
|
|
11
|
-
import '../HttpResponse-
|
|
11
|
+
import '../HttpResponse-BXyXQFMJ.js';
|
|
12
12
|
import '../utils/internal/isIterable.js';
|
|
13
13
|
import '../typeUtils.js';
|
|
14
14
|
import 'graphql';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { U as UnhandledFrameCallback,
|
|
1
|
+
export { U as UnhandledFrameCallback, c as UnhandledFrameDefaults, b as UnhandledFrameHandle, d as UnhandledFrameStrategy, e as executeUnhandledFrameHandle } from '../on-unhandled-frame-gkokW4Rr.mjs';
|
|
2
2
|
import 'rettime';
|
|
3
3
|
import './handlers-controller.mjs';
|
|
4
|
-
import '../HttpResponse-
|
|
4
|
+
import '../HttpResponse-BTyqrRB6.mjs';
|
|
5
5
|
import '@mswjs/interceptors';
|
|
6
6
|
import '../utils/internal/isIterable.mjs';
|
|
7
7
|
import '../typeUtils.mjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { U as UnhandledFrameCallback,
|
|
1
|
+
export { U as UnhandledFrameCallback, c as UnhandledFrameDefaults, b as UnhandledFrameHandle, d as UnhandledFrameStrategy, e as executeUnhandledFrameHandle } from '../on-unhandled-frame-0KmwUmeV.js';
|
|
2
2
|
import 'rettime';
|
|
3
3
|
import './handlers-controller.js';
|
|
4
|
-
import '../HttpResponse-
|
|
4
|
+
import '../HttpResponse-BXyXQFMJ.js';
|
|
5
5
|
import '@mswjs/interceptors';
|
|
6
6
|
import '../utils/internal/isIterable.js';
|
|
7
7
|
import '../typeUtils.js';
|
|
@@ -3,7 +3,7 @@ import { LifeCycleEventEmitter } from '../sharedOptions.mjs';
|
|
|
3
3
|
import { HandlersController, AnyHandler } from './handlers-controller.mjs';
|
|
4
4
|
import { Disposable } from '../utils/internal/Disposable.mjs';
|
|
5
5
|
import '../utils/request/onUnhandledRequest.mjs';
|
|
6
|
-
import '../HttpResponse-
|
|
6
|
+
import '../HttpResponse-BTyqrRB6.mjs';
|
|
7
7
|
import '@mswjs/interceptors';
|
|
8
8
|
import '../utils/internal/isIterable.mjs';
|
|
9
9
|
import '../typeUtils.mjs';
|
|
@@ -3,7 +3,7 @@ import { LifeCycleEventEmitter } from '../sharedOptions.js';
|
|
|
3
3
|
import { HandlersController, AnyHandler } from './handlers-controller.js';
|
|
4
4
|
import { Disposable } from '../utils/internal/Disposable.js';
|
|
5
5
|
import '../utils/request/onUnhandledRequest.js';
|
|
6
|
-
import '../HttpResponse-
|
|
6
|
+
import '../HttpResponse-BXyXQFMJ.js';
|
|
7
7
|
import '@mswjs/interceptors';
|
|
8
8
|
import '../utils/internal/isIterable.js';
|
|
9
9
|
import '../typeUtils.js';
|
|
@@ -2,9 +2,9 @@ import { Interceptor, HttpRequestEventMap } from '@mswjs/interceptors';
|
|
|
2
2
|
import { WebSocketEventMap } from '@mswjs/interceptors/WebSocket';
|
|
3
3
|
import { NetworkSource } from './network-source.mjs';
|
|
4
4
|
import 'rettime';
|
|
5
|
-
import '../../on-unhandled-frame-
|
|
5
|
+
import '../../on-unhandled-frame-gkokW4Rr.mjs';
|
|
6
6
|
import '../handlers-controller.mjs';
|
|
7
|
-
import '../../HttpResponse-
|
|
7
|
+
import '../../HttpResponse-BTyqrRB6.mjs';
|
|
8
8
|
import '../../utils/internal/isIterable.mjs';
|
|
9
9
|
import '../../typeUtils.mjs';
|
|
10
10
|
import 'graphql';
|
|
@@ -2,9 +2,9 @@ import { Interceptor, HttpRequestEventMap } from '@mswjs/interceptors';
|
|
|
2
2
|
import { WebSocketEventMap } from '@mswjs/interceptors/WebSocket';
|
|
3
3
|
import { NetworkSource } from './network-source.js';
|
|
4
4
|
import 'rettime';
|
|
5
|
-
import '../../on-unhandled-frame-
|
|
5
|
+
import '../../on-unhandled-frame-0KmwUmeV.js';
|
|
6
6
|
import '../handlers-controller.js';
|
|
7
|
-
import '../../HttpResponse-
|
|
7
|
+
import '../../HttpResponse-BXyXQFMJ.js';
|
|
8
8
|
import '../../utils/internal/isIterable.js';
|
|
9
9
|
import '../../typeUtils.js';
|
|
10
10
|
import 'graphql';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Emitter, TypedEvent, TypedListenerOptions } from 'rettime';
|
|
2
|
-
import { A as AnyNetworkFrame, E as ExtractFrameEvents } from '../../on-unhandled-frame-
|
|
2
|
+
import { A as AnyNetworkFrame, E as ExtractFrameEvents } from '../../on-unhandled-frame-gkokW4Rr.mjs';
|
|
3
3
|
import '../handlers-controller.mjs';
|
|
4
|
-
import '../../HttpResponse-
|
|
4
|
+
import '../../HttpResponse-BTyqrRB6.mjs';
|
|
5
5
|
import '@mswjs/interceptors';
|
|
6
6
|
import '../../utils/internal/isIterable.mjs';
|
|
7
7
|
import '../../typeUtils.mjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Emitter, TypedEvent, TypedListenerOptions } from 'rettime';
|
|
2
|
-
import { A as AnyNetworkFrame, E as ExtractFrameEvents } from '../../on-unhandled-frame-
|
|
2
|
+
import { A as AnyNetworkFrame, E as ExtractFrameEvents } from '../../on-unhandled-frame-0KmwUmeV.js';
|
|
3
3
|
import '../handlers-controller.js';
|
|
4
|
-
import '../../HttpResponse-
|
|
4
|
+
import '../../HttpResponse-BXyXQFMJ.js';
|
|
5
5
|
import '@mswjs/interceptors';
|
|
6
6
|
import '../../utils/internal/isIterable.js';
|
|
7
7
|
import '../../typeUtils.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RequestHandler,
|
|
1
|
+
import { R as RequestHandler, k as ResponseResolutionContext } from './HttpResponse-BTyqrRB6.mjs';
|
|
2
2
|
import '@mswjs/interceptors';
|
|
3
3
|
import './utils/internal/isIterable.mjs';
|
|
4
4
|
import './typeUtils.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RequestHandler,
|
|
1
|
+
import { R as RequestHandler, k as ResponseResolutionContext } from './HttpResponse-BXyXQFMJ.js';
|
|
2
2
|
import '@mswjs/interceptors';
|
|
3
3
|
import './utils/internal/isIterable.js';
|
|
4
4
|
import './typeUtils.js';
|
package/lib/core/graphql.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { e as GraphQLQuery, h as GraphQLVariables, p as GraphQLPredicate, l as ResponseResolver, q as GraphQLResolverExtras, g as GraphQLResponseBody, j as RequestHandlerOptions, b as GraphQLHandler } from './HttpResponse-BTyqrRB6.mjs';
|
|
2
2
|
import { Path } from './utils/matching/matchRequestUrl.mjs';
|
|
3
3
|
import '@mswjs/interceptors';
|
|
4
4
|
import './utils/internal/isIterable.mjs';
|
package/lib/core/graphql.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { e as GraphQLQuery, h as GraphQLVariables, p as GraphQLPredicate, l as ResponseResolver, q as GraphQLResolverExtras, g as GraphQLResponseBody, j as RequestHandlerOptions, b as GraphQLHandler } from './HttpResponse-BXyXQFMJ.js';
|
|
2
2
|
import { Path } from './utils/matching/matchRequestUrl.js';
|
|
3
3
|
import '@mswjs/interceptors';
|
|
4
4
|
import './utils/internal/isIterable.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'graphql';
|
|
2
|
-
export { z as DocumentTypeDecoration,
|
|
2
|
+
export { z as DocumentTypeDecoration, G as GraphQLCustomPredicate, B as GraphQLCustomPredicateResult, b as GraphQLHandler, C as GraphQLHandlerInfo, E as GraphQLHandlerNameSelector, c as GraphQLJsonRequestBody, d as GraphQLOperationType, p as GraphQLPredicate, e as GraphQLQuery, f as GraphQLRequestBody, F as GraphQLRequestParsedResult, q as GraphQLResolverExtras, g as GraphQLResponseBody, h as GraphQLVariables, I as isDocumentNode } from '../HttpResponse-BTyqrRB6.mjs';
|
|
3
3
|
import '../utils/matching/matchRequestUrl.mjs';
|
|
4
4
|
import '@mswjs/interceptors';
|
|
5
5
|
import '../utils/internal/isIterable.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'graphql';
|
|
2
|
-
export { z as DocumentTypeDecoration,
|
|
2
|
+
export { z as DocumentTypeDecoration, G as GraphQLCustomPredicate, B as GraphQLCustomPredicateResult, b as GraphQLHandler, C as GraphQLHandlerInfo, E as GraphQLHandlerNameSelector, c as GraphQLJsonRequestBody, d as GraphQLOperationType, p as GraphQLPredicate, e as GraphQLQuery, f as GraphQLRequestBody, F as GraphQLRequestParsedResult, q as GraphQLResolverExtras, g as GraphQLResponseBody, h as GraphQLVariables, I as isDocumentNode } from '../HttpResponse-BXyXQFMJ.js';
|
|
3
3
|
import '../utils/matching/matchRequestUrl.js';
|
|
4
4
|
import '@mswjs/interceptors';
|
|
5
5
|
import '../utils/internal/isIterable.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RequestHandler, r as RequestHandlerDefaultInfo,
|
|
1
|
+
import { R as RequestHandler, r as RequestHandlerDefaultInfo, l as ResponseResolver, j as RequestHandlerOptions, k as ResponseResolutionContext } from '../HttpResponse-BTyqrRB6.mjs';
|
|
2
2
|
import { PathParams, Path, Match } from '../utils/matching/matchRequestUrl.mjs';
|
|
3
3
|
import '@mswjs/interceptors';
|
|
4
4
|
import '../utils/internal/isIterable.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RequestHandler, r as RequestHandlerDefaultInfo,
|
|
1
|
+
import { R as RequestHandler, r as RequestHandlerDefaultInfo, l as ResponseResolver, j as RequestHandlerOptions, k as ResponseResolutionContext } from '../HttpResponse-BXyXQFMJ.js';
|
|
2
2
|
import { PathParams, Path, Match } from '../utils/matching/matchRequestUrl.js';
|
|
3
3
|
import '@mswjs/interceptors';
|
|
4
4
|
import '../utils/internal/isIterable.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../utils/internal/isIterable.mjs';
|
|
2
|
-
export { A as AsyncResponseResolverReturnType, D as DefaultBodyType,
|
|
2
|
+
export { A as AsyncResponseResolverReturnType, D as DefaultBodyType, a as DefaultRequestMultipartBody, J as JsonBodyType, M as MaybeAsyncResponseResolverReturnType, R as RequestHandler, K as RequestHandlerArgs, r as RequestHandlerDefaultInfo, L as RequestHandlerExecutionResult, N as RequestHandlerInternalInfo, j as RequestHandlerOptions, l as ResponseResolver, m as ResponseResolverInfo, n as ResponseResolverReturnType, O as forwardResponseCookies } from '../HttpResponse-BTyqrRB6.mjs';
|
|
3
3
|
import '../typeUtils.mjs';
|
|
4
4
|
import '@mswjs/interceptors';
|
|
5
5
|
import 'graphql';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../utils/internal/isIterable.js';
|
|
2
|
-
export { A as AsyncResponseResolverReturnType, D as DefaultBodyType,
|
|
2
|
+
export { A as AsyncResponseResolverReturnType, D as DefaultBodyType, a as DefaultRequestMultipartBody, J as JsonBodyType, M as MaybeAsyncResponseResolverReturnType, R as RequestHandler, K as RequestHandlerArgs, r as RequestHandlerDefaultInfo, L as RequestHandlerExecutionResult, N as RequestHandlerInternalInfo, j as RequestHandlerOptions, l as ResponseResolver, m as ResponseResolverInfo, n as ResponseResolverReturnType, O as forwardResponseCookies } from '../HttpResponse-BXyXQFMJ.js';
|
|
3
3
|
import '../typeUtils.js';
|
|
4
4
|
import '@mswjs/interceptors';
|
|
5
5
|
import 'graphql';
|