msw 2.7.0 → 2.7.2
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 +8 -1
- package/lib/core/{GraphQLHandler-CLv2BIIm.d.mts → GraphQLHandler-D4_CxZQj.d.mts} +1 -1
- package/lib/core/{GraphQLHandler-C5CUIS_N.d.ts → GraphQLHandler-Pox7fIFM.d.ts} +1 -1
- package/lib/core/{HttpResponse-CFPhtDH3.d.mts → HttpResponse-BRDnWbjc.d.mts} +4 -2
- package/lib/core/{HttpResponse-5Sn2vNaJ.d.ts → HttpResponse-Cy7ytzUn.d.ts} +4 -2
- package/lib/core/HttpResponse.d.mts +2 -1
- package/lib/core/HttpResponse.d.ts +2 -1
- package/lib/core/HttpResponse.js +4 -1
- package/lib/core/HttpResponse.js.map +1 -1
- package/lib/core/HttpResponse.mjs +4 -1
- package/lib/core/HttpResponse.mjs.map +1 -1
- package/lib/core/SetupApi.d.mts +2 -1
- package/lib/core/SetupApi.d.ts +2 -1
- package/lib/core/getResponse.d.mts +2 -1
- package/lib/core/getResponse.d.ts +2 -1
- package/lib/core/graphql.d.mts +3 -2
- package/lib/core/graphql.d.ts +3 -2
- package/lib/core/handlers/GraphQLHandler.d.mts +3 -2
- package/lib/core/handlers/GraphQLHandler.d.ts +3 -2
- package/lib/core/handlers/HttpHandler.d.mts +2 -1
- package/lib/core/handlers/HttpHandler.d.ts +2 -1
- package/lib/core/handlers/RequestHandler.d.mts +2 -1
- package/lib/core/handlers/RequestHandler.d.ts +2 -1
- package/lib/core/http.d.mts +2 -1
- package/lib/core/http.d.ts +2 -1
- package/lib/core/index.d.mts +3 -2
- package/lib/core/index.d.ts +3 -2
- package/lib/core/passthrough.d.mts +2 -1
- package/lib/core/passthrough.d.ts +2 -1
- package/lib/core/utils/HttpResponse/decorators.d.mts +2 -1
- package/lib/core/utils/HttpResponse/decorators.d.ts +2 -1
- package/lib/core/utils/executeHandlers.d.mts +2 -1
- package/lib/core/utils/executeHandlers.d.ts +2 -1
- package/lib/core/utils/handleRequest.d.mts +2 -1
- package/lib/core/utils/handleRequest.d.ts +2 -1
- package/lib/core/utils/internal/isHandlerKind.d.mts +2 -1
- package/lib/core/utils/internal/isHandlerKind.d.ts +2 -1
- package/lib/core/utils/internal/parseGraphQLRequest.d.mts +3 -2
- package/lib/core/utils/internal/parseGraphQLRequest.d.ts +3 -2
- package/lib/core/utils/internal/parseMultipartData.d.mts +2 -1
- package/lib/core/utils/internal/parseMultipartData.d.ts +2 -1
- package/lib/core/utils/internal/requestHandlerUtils.d.mts +2 -1
- package/lib/core/utils/internal/requestHandlerUtils.d.ts +2 -1
- package/lib/core/ws/handleWebSocketEvent.d.mts +2 -1
- package/lib/core/ws/handleWebSocketEvent.d.ts +2 -1
- package/lib/iife/index.js +3 -1
- package/lib/iife/index.js.map +1 -1
- package/lib/mockServiceWorker.js +1 -1
- package/package.json +1 -1
- package/src/core/HttpResponse.test.ts +4 -0
- package/src/core/HttpResponse.ts +7 -4
- package/src/core/utils/handleRequest.test.ts +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
</p>
|
|
15
15
|
|
|
16
16
|
<h1 align="center">Mock Service Worker</h1>
|
|
17
|
-
<p align="center">
|
|
17
|
+
<p align="center">Industry standard API mocking for JavaScript.</p>
|
|
18
18
|
|
|
19
19
|
<p align="center">
|
|
20
20
|
<a href="https://www.npmjs.com/package/msw" target="_blank"><img src="https://img.shields.io/npm/v/msw.svg?style=for-the-badge&label=Latest&color=black" alt="Package version" /></a>
|
|
@@ -223,6 +223,13 @@ Mock Service Worker is trusted by hundreds of thousands of engineers around the
|
|
|
223
223
|
</a>
|
|
224
224
|
</td>
|
|
225
225
|
</tr>
|
|
226
|
+
<tr>
|
|
227
|
+
<td align="center">
|
|
228
|
+
<a href="https://stackblitz.com/" target="_blank">
|
|
229
|
+
<img src="media/sponsors/stackblitz.svg" alt="StackBlitz" height="64" />
|
|
230
|
+
</a>
|
|
231
|
+
</td>
|
|
232
|
+
</tr>
|
|
226
233
|
</table>
|
|
227
234
|
|
|
228
235
|
### Silver Sponsors
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OperationTypeNode, DocumentNode, GraphQLError } from 'graphql';
|
|
2
|
-
import { g as RequestHandlerDefaultInfo, D as DefaultBodyType, R as RequestHandler, a as ResponseResolver, c as RequestHandlerOptions } from './HttpResponse-
|
|
2
|
+
import { g as RequestHandlerDefaultInfo, D as DefaultBodyType, R as RequestHandler, a as ResponseResolver, c as RequestHandlerOptions } from './HttpResponse-BRDnWbjc.mjs';
|
|
3
3
|
import { Match, Path } from './utils/matching/matchRequestUrl.mjs';
|
|
4
4
|
|
|
5
5
|
interface ParsedGraphQLQuery {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OperationTypeNode, DocumentNode, GraphQLError } from 'graphql';
|
|
2
|
-
import { g as RequestHandlerDefaultInfo, D as DefaultBodyType, R as RequestHandler, a as ResponseResolver, c as RequestHandlerOptions } from './HttpResponse-
|
|
2
|
+
import { g as RequestHandlerDefaultInfo, D as DefaultBodyType, R as RequestHandler, a as ResponseResolver, c as RequestHandlerOptions } from './HttpResponse-Cy7ytzUn.js';
|
|
3
3
|
import { Match, Path } from './utils/matching/matchRequestUrl.js';
|
|
4
4
|
|
|
5
5
|
interface ParsedGraphQLQuery {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FetchResponse } from '@mswjs/interceptors';
|
|
1
2
|
import { Iterable, AsyncIterable } from './utils/internal/isIterable.mjs';
|
|
2
3
|
import { MaybePromise, NoInfer } from './typeUtils.mjs';
|
|
3
4
|
|
|
@@ -120,10 +121,10 @@ declare abstract class RequestHandler<HandlerInfo extends RequestHandlerDefaultI
|
|
|
120
121
|
private createExecutionResult;
|
|
121
122
|
}
|
|
122
123
|
|
|
124
|
+
declare const bodyType: unique symbol;
|
|
123
125
|
interface HttpResponseInit extends ResponseInit {
|
|
124
126
|
type?: ResponseType;
|
|
125
127
|
}
|
|
126
|
-
declare const bodyType: unique symbol;
|
|
127
128
|
interface StrictRequest<BodyType extends DefaultBodyType> extends Request {
|
|
128
129
|
json(): Promise<BodyType>;
|
|
129
130
|
}
|
|
@@ -144,7 +145,8 @@ interface StrictResponse<BodyType extends DefaultBodyType> extends Response {
|
|
|
144
145
|
*
|
|
145
146
|
* @see {@link https://mswjs.io/docs/api/http-response `HttpResponse` API reference}
|
|
146
147
|
*/
|
|
147
|
-
declare class HttpResponse extends
|
|
148
|
+
declare class HttpResponse extends FetchResponse {
|
|
149
|
+
readonly [bodyType]: any;
|
|
148
150
|
constructor(body?: BodyInit | null, init?: HttpResponseInit);
|
|
149
151
|
/**
|
|
150
152
|
* Create a `Response` with a `Content-Type: "text/plain"` body.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FetchResponse } from '@mswjs/interceptors';
|
|
1
2
|
import { Iterable, AsyncIterable } from './utils/internal/isIterable.js';
|
|
2
3
|
import { MaybePromise, NoInfer } from './typeUtils.js';
|
|
3
4
|
|
|
@@ -120,10 +121,10 @@ declare abstract class RequestHandler<HandlerInfo extends RequestHandlerDefaultI
|
|
|
120
121
|
private createExecutionResult;
|
|
121
122
|
}
|
|
122
123
|
|
|
124
|
+
declare const bodyType: unique symbol;
|
|
123
125
|
interface HttpResponseInit extends ResponseInit {
|
|
124
126
|
type?: ResponseType;
|
|
125
127
|
}
|
|
126
|
-
declare const bodyType: unique symbol;
|
|
127
128
|
interface StrictRequest<BodyType extends DefaultBodyType> extends Request {
|
|
128
129
|
json(): Promise<BodyType>;
|
|
129
130
|
}
|
|
@@ -144,7 +145,8 @@ interface StrictResponse<BodyType extends DefaultBodyType> extends Response {
|
|
|
144
145
|
*
|
|
145
146
|
* @see {@link https://mswjs.io/docs/api/http-response `HttpResponse` API reference}
|
|
146
147
|
*/
|
|
147
|
-
declare class HttpResponse extends
|
|
148
|
+
declare class HttpResponse extends FetchResponse {
|
|
149
|
+
readonly [bodyType]: any;
|
|
148
150
|
constructor(body?: BodyInit | null, init?: HttpResponseInit);
|
|
149
151
|
/**
|
|
150
152
|
* Create a `Response` with a `Content-Type: "text/plain"` body.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import '@mswjs/interceptors';
|
|
2
|
+
export { f as HttpResponse, H as HttpResponseInit, S as StrictRequest, e as StrictResponse } from './HttpResponse-BRDnWbjc.mjs';
|
|
2
3
|
import './typeUtils.mjs';
|
|
3
4
|
import './utils/internal/isIterable.mjs';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import '@mswjs/interceptors';
|
|
2
|
+
export { f as HttpResponse, H as HttpResponseInit, S as StrictRequest, e as StrictResponse } from './HttpResponse-Cy7ytzUn.js';
|
|
2
3
|
import './typeUtils.js';
|
|
3
4
|
import './utils/internal/isIterable.js';
|
package/lib/core/HttpResponse.js
CHANGED
|
@@ -21,8 +21,11 @@ __export(HttpResponse_exports, {
|
|
|
21
21
|
HttpResponse: () => HttpResponse
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(HttpResponse_exports);
|
|
24
|
+
var import_interceptors = require("@mswjs/interceptors");
|
|
24
25
|
var import_decorators = require("./utils/HttpResponse/decorators.js");
|
|
25
|
-
|
|
26
|
+
const bodyType = Symbol("bodyType");
|
|
27
|
+
class HttpResponse extends import_interceptors.FetchResponse {
|
|
28
|
+
[bodyType];
|
|
26
29
|
constructor(body, init) {
|
|
27
30
|
const responseInit = (0, import_decorators.normalizeResponseInit)(init);
|
|
28
31
|
super(body, responseInit);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/HttpResponse.ts"],"sourcesContent":["import 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\
|
|
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\nconst bodyType = Symbol('bodyType')\n\nexport interface HttpResponseInit extends ResponseInit {\n type?: ResponseType\n}\n\nexport interface StrictRequest<BodyType extends DefaultBodyType>\n extends Request {\n json(): Promise<BodyType>\n}\n\n/**\n * Opaque `Response` type that supports strict body type.\n */\nexport interface StrictResponse<BodyType extends DefaultBodyType>\n extends Response {\n readonly [bodyType]: BodyType\n}\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 extends FetchResponse {\n readonly [bodyType]: any\n\n constructor(body?: BodyInit | null, init?: HttpResponseInit) {\n const responseInit = normalizeResponseInit(init)\n super(body, responseInit)\n decorateResponse(this, responseInit)\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 ): StrictResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n\n if (!responseInit.headers.has('Content-Type')) {\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 return new HttpResponse(body, responseInit) as StrictResponse<BodyType>\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,\n init?: HttpResponseInit,\n ): StrictResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n\n if (!responseInit.headers.has('Content-Type')) {\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 return new HttpResponse(\n responseText,\n responseInit,\n ) as StrictResponse<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 ): Response {\n const responseInit = normalizeResponseInit(init)\n\n if (!responseInit.headers.has('Content-Type')) {\n responseInit.headers.set('Content-Type', 'text/xml')\n }\n\n return new HttpResponse(body, responseInit)\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 ): Response {\n const responseInit = normalizeResponseInit(init)\n\n if (!responseInit.headers.has('Content-Type')) {\n responseInit.headers.set('Content-Type', 'text/html')\n }\n\n return new HttpResponse(body, responseInit)\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(\n body?: ArrayBuffer | SharedArrayBuffer,\n init?: HttpResponseInit,\n ): Response {\n const responseInit = normalizeResponseInit(init)\n\n if (!responseInit.headers.has('Content-Type')) {\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 return new HttpResponse(body as ArrayBuffer, responseInit)\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(body?: FormData, init?: HttpResponseInit): Response {\n return new HttpResponse(body, normalizeResponseInit(init))\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA8B;AAG9B,wBAGO;AAEP,MAAM,WAAW,OAAO,UAAU;AA8B3B,MAAM,qBAAqB,kCAAc;AAAA,EAC9C,CAAU,QAAQ;AAAA,EAElB,YAAY,MAAwB,MAAyB;AAC3D,UAAM,mBAAe,yCAAsB,IAAI;AAC/C,UAAM,MAAM,YAAY;AACxB,4CAAiB,MAAM,YAAY;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAO,KACL,MACA,MAC0B;AAC1B,UAAM,mBAAe,yCAAsB,IAAI;AAE/C,QAAI,CAAC,aAAa,QAAQ,IAAI,cAAc,GAAG;AAC7C,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,WAAO,IAAI,aAAa,MAAM,YAAY;AAAA,EAC5C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAO,KACL,MACA,MAC0B;AAC1B,UAAM,mBAAe,yCAAsB,IAAI;AAE/C,QAAI,CAAC,aAAa,QAAQ,IAAI,cAAc,GAAG;AAC7C,mBAAa,QAAQ,IAAI,gBAAgB,kBAAkB;AAAA,IAC7D;AAMA,UAAM,eAAe,KAAK,UAAU,IAAI;AAExC,QAAI,CAAC,aAAa,QAAQ,IAAI,gBAAgB,GAAG;AAC/C,mBAAa,QAAQ;AAAA,QACnB;AAAA,QACA,eAAe,IAAI,KAAK,CAAC,YAAY,CAAC,EAAE,KAAK,SAAS,IAAI;AAAA,MAC5D;AAAA,IACF;AAEA,WAAO,IAAI;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAO,IACL,MACA,MACU;AACV,UAAM,mBAAe,yCAAsB,IAAI;AAE/C,QAAI,CAAC,aAAa,QAAQ,IAAI,cAAc,GAAG;AAC7C,mBAAa,QAAQ,IAAI,gBAAgB,UAAU;AAAA,IACrD;AAEA,WAAO,IAAI,aAAa,MAAM,YAAY;AAAA,EAC5C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAO,KACL,MACA,MACU;AACV,UAAM,mBAAe,yCAAsB,IAAI;AAE/C,QAAI,CAAC,aAAa,QAAQ,IAAI,cAAc,GAAG;AAC7C,mBAAa,QAAQ,IAAI,gBAAgB,WAAW;AAAA,IACtD;AAEA,WAAO,IAAI,aAAa,MAAM,YAAY;AAAA,EAC5C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,OAAO,YACL,MACA,MACU;AACV,UAAM,mBAAe,yCAAsB,IAAI;AAE/C,QAAI,CAAC,aAAa,QAAQ,IAAI,cAAc,GAAG;AAC7C,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,WAAO,IAAI,aAAa,MAAqB,YAAY;AAAA,EAC3D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,OAAO,SAAS,MAAiB,MAAmC;AAClE,WAAO,IAAI,aAAa,UAAM,yCAAsB,IAAI,CAAC;AAAA,EAC3D;AACF;","names":[]}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { FetchResponse } from "@mswjs/interceptors";
|
|
1
2
|
import {
|
|
2
3
|
decorateResponse,
|
|
3
4
|
normalizeResponseInit
|
|
4
5
|
} from './utils/HttpResponse/decorators.mjs';
|
|
5
|
-
|
|
6
|
+
const bodyType = Symbol("bodyType");
|
|
7
|
+
class HttpResponse extends FetchResponse {
|
|
8
|
+
[bodyType];
|
|
6
9
|
constructor(body, init) {
|
|
7
10
|
const responseInit = normalizeResponseInit(init);
|
|
8
11
|
super(body, responseInit);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/HttpResponse.ts"],"sourcesContent":["import 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\
|
|
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\nconst bodyType = Symbol('bodyType')\n\nexport interface HttpResponseInit extends ResponseInit {\n type?: ResponseType\n}\n\nexport interface StrictRequest<BodyType extends DefaultBodyType>\n extends Request {\n json(): Promise<BodyType>\n}\n\n/**\n * Opaque `Response` type that supports strict body type.\n */\nexport interface StrictResponse<BodyType extends DefaultBodyType>\n extends Response {\n readonly [bodyType]: BodyType\n}\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 extends FetchResponse {\n readonly [bodyType]: any\n\n constructor(body?: BodyInit | null, init?: HttpResponseInit) {\n const responseInit = normalizeResponseInit(init)\n super(body, responseInit)\n decorateResponse(this, responseInit)\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 ): StrictResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n\n if (!responseInit.headers.has('Content-Type')) {\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 return new HttpResponse(body, responseInit) as StrictResponse<BodyType>\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,\n init?: HttpResponseInit,\n ): StrictResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n\n if (!responseInit.headers.has('Content-Type')) {\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 return new HttpResponse(\n responseText,\n responseInit,\n ) as StrictResponse<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 ): Response {\n const responseInit = normalizeResponseInit(init)\n\n if (!responseInit.headers.has('Content-Type')) {\n responseInit.headers.set('Content-Type', 'text/xml')\n }\n\n return new HttpResponse(body, responseInit)\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 ): Response {\n const responseInit = normalizeResponseInit(init)\n\n if (!responseInit.headers.has('Content-Type')) {\n responseInit.headers.set('Content-Type', 'text/html')\n }\n\n return new HttpResponse(body, responseInit)\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(\n body?: ArrayBuffer | SharedArrayBuffer,\n init?: HttpResponseInit,\n ): Response {\n const responseInit = normalizeResponseInit(init)\n\n if (!responseInit.headers.has('Content-Type')) {\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 return new HttpResponse(body as ArrayBuffer, responseInit)\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(body?: FormData, init?: HttpResponseInit): Response {\n return new HttpResponse(body, normalizeResponseInit(init))\n }\n}\n"],"mappings":"AAAA,SAAS,qBAAqB;AAG9B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP,MAAM,WAAW,OAAO,UAAU;AA8B3B,MAAM,qBAAqB,cAAc;AAAA,EAC9C,CAAU,QAAQ;AAAA,EAElB,YAAY,MAAwB,MAAyB;AAC3D,UAAM,eAAe,sBAAsB,IAAI;AAC/C,UAAM,MAAM,YAAY;AACxB,qBAAiB,MAAM,YAAY;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAO,KACL,MACA,MAC0B;AAC1B,UAAM,eAAe,sBAAsB,IAAI;AAE/C,QAAI,CAAC,aAAa,QAAQ,IAAI,cAAc,GAAG;AAC7C,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,WAAO,IAAI,aAAa,MAAM,YAAY;AAAA,EAC5C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAO,KACL,MACA,MAC0B;AAC1B,UAAM,eAAe,sBAAsB,IAAI;AAE/C,QAAI,CAAC,aAAa,QAAQ,IAAI,cAAc,GAAG;AAC7C,mBAAa,QAAQ,IAAI,gBAAgB,kBAAkB;AAAA,IAC7D;AAMA,UAAM,eAAe,KAAK,UAAU,IAAI;AAExC,QAAI,CAAC,aAAa,QAAQ,IAAI,gBAAgB,GAAG;AAC/C,mBAAa,QAAQ;AAAA,QACnB;AAAA,QACA,eAAe,IAAI,KAAK,CAAC,YAAY,CAAC,EAAE,KAAK,SAAS,IAAI;AAAA,MAC5D;AAAA,IACF;AAEA,WAAO,IAAI;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAO,IACL,MACA,MACU;AACV,UAAM,eAAe,sBAAsB,IAAI;AAE/C,QAAI,CAAC,aAAa,QAAQ,IAAI,cAAc,GAAG;AAC7C,mBAAa,QAAQ,IAAI,gBAAgB,UAAU;AAAA,IACrD;AAEA,WAAO,IAAI,aAAa,MAAM,YAAY;AAAA,EAC5C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAO,KACL,MACA,MACU;AACV,UAAM,eAAe,sBAAsB,IAAI;AAE/C,QAAI,CAAC,aAAa,QAAQ,IAAI,cAAc,GAAG;AAC7C,mBAAa,QAAQ,IAAI,gBAAgB,WAAW;AAAA,IACtD;AAEA,WAAO,IAAI,aAAa,MAAM,YAAY;AAAA,EAC5C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,OAAO,YACL,MACA,MACU;AACV,UAAM,eAAe,sBAAsB,IAAI;AAE/C,QAAI,CAAC,aAAa,QAAQ,IAAI,cAAc,GAAG;AAC7C,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,WAAO,IAAI,aAAa,MAAqB,YAAY;AAAA,EAC3D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,OAAO,SAAS,MAAiB,MAAmC;AAClE,WAAO,IAAI,aAAa,MAAM,sBAAsB,IAAI,CAAC;AAAA,EAC3D;AACF;","names":[]}
|
package/lib/core/SetupApi.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { EventMap, Emitter } from 'strict-event-emitter';
|
|
2
|
-
import { R as RequestHandler } from './HttpResponse-
|
|
2
|
+
import { R as RequestHandler } from './HttpResponse-BRDnWbjc.mjs';
|
|
3
3
|
import { LifeCycleEventEmitter } from './sharedOptions.mjs';
|
|
4
4
|
import { Disposable } from './utils/internal/Disposable.mjs';
|
|
5
5
|
import { WebSocketHandler } from './handlers/WebSocketHandler.mjs';
|
|
6
|
+
import '@mswjs/interceptors';
|
|
6
7
|
import './utils/internal/isIterable.mjs';
|
|
7
8
|
import './typeUtils.mjs';
|
|
8
9
|
import './utils/request/onUnhandledRequest.mjs';
|
package/lib/core/SetupApi.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { EventMap, Emitter } from 'strict-event-emitter';
|
|
2
|
-
import { R as RequestHandler } from './HttpResponse-
|
|
2
|
+
import { R as RequestHandler } from './HttpResponse-Cy7ytzUn.js';
|
|
3
3
|
import { LifeCycleEventEmitter } from './sharedOptions.js';
|
|
4
4
|
import { Disposable } from './utils/internal/Disposable.js';
|
|
5
5
|
import { WebSocketHandler } from './handlers/WebSocketHandler.js';
|
|
6
|
+
import '@mswjs/interceptors';
|
|
6
7
|
import './utils/internal/isIterable.js';
|
|
7
8
|
import './typeUtils.js';
|
|
8
9
|
import './utils/request/onUnhandledRequest.js';
|
package/lib/core/graphql.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { DocumentNode } from 'graphql';
|
|
2
|
-
import { c as RequestHandlerOptions, a as ResponseResolver } from './HttpResponse-
|
|
3
|
-
import { a as GraphQLQuery, b as GraphQLVariables, e as GraphQLHandlerNameSelector, G as GraphQLHandler, f as GraphQLResolverExtras, g as GraphQLResponseBody } from './GraphQLHandler-
|
|
2
|
+
import { c as RequestHandlerOptions, a as ResponseResolver } from './HttpResponse-BRDnWbjc.mjs';
|
|
3
|
+
import { a as GraphQLQuery, b as GraphQLVariables, e as GraphQLHandlerNameSelector, G as GraphQLHandler, f as GraphQLResolverExtras, g as GraphQLResponseBody } from './GraphQLHandler-D4_CxZQj.mjs';
|
|
4
4
|
import { Path } from './utils/matching/matchRequestUrl.mjs';
|
|
5
|
+
import '@mswjs/interceptors';
|
|
5
6
|
import './utils/internal/isIterable.mjs';
|
|
6
7
|
import './typeUtils.mjs';
|
|
7
8
|
|
package/lib/core/graphql.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { DocumentNode } from 'graphql';
|
|
2
|
-
import { c as RequestHandlerOptions, a as ResponseResolver } from './HttpResponse-
|
|
3
|
-
import { a as GraphQLQuery, b as GraphQLVariables, e as GraphQLHandlerNameSelector, G as GraphQLHandler, f as GraphQLResolverExtras, g as GraphQLResponseBody } from './GraphQLHandler-
|
|
2
|
+
import { c as RequestHandlerOptions, a as ResponseResolver } from './HttpResponse-Cy7ytzUn.js';
|
|
3
|
+
import { a as GraphQLQuery, b as GraphQLVariables, e as GraphQLHandlerNameSelector, G as GraphQLHandler, f as GraphQLResolverExtras, g as GraphQLResponseBody } from './GraphQLHandler-Pox7fIFM.js';
|
|
4
4
|
import { Path } from './utils/matching/matchRequestUrl.js';
|
|
5
|
+
import '@mswjs/interceptors';
|
|
5
6
|
import './utils/internal/isIterable.js';
|
|
6
7
|
import './typeUtils.js';
|
|
7
8
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import 'graphql';
|
|
2
|
-
import '../HttpResponse-
|
|
2
|
+
import '../HttpResponse-BRDnWbjc.mjs';
|
|
3
3
|
import '../utils/matching/matchRequestUrl.mjs';
|
|
4
|
-
export { E as ExpectedOperationTypeNode, G as GraphQLHandler, l as GraphQLHandlerInfo, e as GraphQLHandlerNameSelector, d as GraphQLJsonRequestBody, a as GraphQLQuery, c as GraphQLRequestBody, m as GraphQLRequestParsedResult, f as GraphQLResolverExtras, g as GraphQLResponseBody, b as GraphQLVariables, n as isDocumentNode } from '../GraphQLHandler-
|
|
4
|
+
export { E as ExpectedOperationTypeNode, G as GraphQLHandler, l as GraphQLHandlerInfo, e as GraphQLHandlerNameSelector, d as GraphQLJsonRequestBody, a as GraphQLQuery, c as GraphQLRequestBody, m as GraphQLRequestParsedResult, f as GraphQLResolverExtras, g as GraphQLResponseBody, b as GraphQLVariables, n as isDocumentNode } from '../GraphQLHandler-D4_CxZQj.mjs';
|
|
5
|
+
import '@mswjs/interceptors';
|
|
5
6
|
import '../utils/internal/isIterable.mjs';
|
|
6
7
|
import '../typeUtils.mjs';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import 'graphql';
|
|
2
|
-
import '../HttpResponse-
|
|
2
|
+
import '../HttpResponse-Cy7ytzUn.js';
|
|
3
3
|
import '../utils/matching/matchRequestUrl.js';
|
|
4
|
-
export { E as ExpectedOperationTypeNode, G as GraphQLHandler, l as GraphQLHandlerInfo, e as GraphQLHandlerNameSelector, d as GraphQLJsonRequestBody, a as GraphQLQuery, c as GraphQLRequestBody, m as GraphQLRequestParsedResult, f as GraphQLResolverExtras, g as GraphQLResponseBody, b as GraphQLVariables, n as isDocumentNode } from '../GraphQLHandler-
|
|
4
|
+
export { E as ExpectedOperationTypeNode, G as GraphQLHandler, l as GraphQLHandlerInfo, e as GraphQLHandlerNameSelector, d as GraphQLJsonRequestBody, a as GraphQLQuery, c as GraphQLRequestBody, m as GraphQLRequestParsedResult, f as GraphQLResolverExtras, g as GraphQLResponseBody, b as GraphQLVariables, n as isDocumentNode } from '../GraphQLHandler-Pox7fIFM.js';
|
|
5
|
+
import '@mswjs/interceptors';
|
|
5
6
|
import '../utils/internal/isIterable.js';
|
|
6
7
|
import '../typeUtils.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { g as RequestHandlerDefaultInfo, R as RequestHandler, a as ResponseResolver, c as RequestHandlerOptions, h as ResponseResolutionContext } from '../HttpResponse-
|
|
1
|
+
import { g as RequestHandlerDefaultInfo, R as RequestHandler, a as ResponseResolver, c as RequestHandlerOptions, h as ResponseResolutionContext } from '../HttpResponse-BRDnWbjc.mjs';
|
|
2
2
|
import { Path, Match, PathParams } from '../utils/matching/matchRequestUrl.mjs';
|
|
3
|
+
import '@mswjs/interceptors';
|
|
3
4
|
import '../utils/internal/isIterable.mjs';
|
|
4
5
|
import '../typeUtils.mjs';
|
|
5
6
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { g as RequestHandlerDefaultInfo, R as RequestHandler, a as ResponseResolver, c as RequestHandlerOptions, h as ResponseResolutionContext } from '../HttpResponse-
|
|
1
|
+
import { g as RequestHandlerDefaultInfo, R as RequestHandler, a as ResponseResolver, c as RequestHandlerOptions, h as ResponseResolutionContext } from '../HttpResponse-Cy7ytzUn.js';
|
|
2
2
|
import { Path, Match, PathParams } from '../utils/matching/matchRequestUrl.js';
|
|
3
|
+
import '@mswjs/interceptors';
|
|
3
4
|
import '../utils/internal/isIterable.js';
|
|
4
5
|
import '../typeUtils.js';
|
|
5
6
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import '../utils/internal/isIterable.mjs';
|
|
2
|
-
export { A as AsyncResponseResolverReturnType, D as DefaultBodyType, d as DefaultRequestMultipartBody, J as JsonBodyType, M as MaybeAsyncResponseResolverReturnType, R as RequestHandler, m as RequestHandlerArgs, g as RequestHandlerDefaultInfo, n as RequestHandlerExecutionResult, k as RequestHandlerInternalInfo, c as RequestHandlerOptions, a as ResponseResolver, l as ResponseResolverInfo, b as ResponseResolverReturnType } from '../HttpResponse-
|
|
2
|
+
export { A as AsyncResponseResolverReturnType, D as DefaultBodyType, d as DefaultRequestMultipartBody, J as JsonBodyType, M as MaybeAsyncResponseResolverReturnType, R as RequestHandler, m as RequestHandlerArgs, g as RequestHandlerDefaultInfo, n as RequestHandlerExecutionResult, k as RequestHandlerInternalInfo, c as RequestHandlerOptions, a as ResponseResolver, l as ResponseResolverInfo, b as ResponseResolverReturnType } from '../HttpResponse-BRDnWbjc.mjs';
|
|
3
3
|
import '../typeUtils.mjs';
|
|
4
|
+
import '@mswjs/interceptors';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import '../utils/internal/isIterable.js';
|
|
2
|
-
export { A as AsyncResponseResolverReturnType, D as DefaultBodyType, d as DefaultRequestMultipartBody, J as JsonBodyType, M as MaybeAsyncResponseResolverReturnType, R as RequestHandler, m as RequestHandlerArgs, g as RequestHandlerDefaultInfo, n as RequestHandlerExecutionResult, k as RequestHandlerInternalInfo, c as RequestHandlerOptions, a as ResponseResolver, l as ResponseResolverInfo, b as ResponseResolverReturnType } from '../HttpResponse-
|
|
2
|
+
export { A as AsyncResponseResolverReturnType, D as DefaultBodyType, d as DefaultRequestMultipartBody, J as JsonBodyType, M as MaybeAsyncResponseResolverReturnType, R as RequestHandler, m as RequestHandlerArgs, g as RequestHandlerDefaultInfo, n as RequestHandlerExecutionResult, k as RequestHandlerInternalInfo, c as RequestHandlerOptions, a as ResponseResolver, l as ResponseResolverInfo, b as ResponseResolverReturnType } from '../HttpResponse-Cy7ytzUn.js';
|
|
3
3
|
import '../typeUtils.js';
|
|
4
|
+
import '@mswjs/interceptors';
|
package/lib/core/http.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { D as DefaultBodyType, c as RequestHandlerOptions, a as ResponseResolver } from './HttpResponse-
|
|
1
|
+
import { D as DefaultBodyType, c as RequestHandlerOptions, a as ResponseResolver } from './HttpResponse-BRDnWbjc.mjs';
|
|
2
2
|
import { HttpHandler, HttpRequestResolverExtras } from './handlers/HttpHandler.mjs';
|
|
3
3
|
import { PathParams, Path } from './utils/matching/matchRequestUrl.mjs';
|
|
4
|
+
import '@mswjs/interceptors';
|
|
4
5
|
import './utils/internal/isIterable.mjs';
|
|
5
6
|
import './typeUtils.mjs';
|
|
6
7
|
|
package/lib/core/http.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { D as DefaultBodyType, c as RequestHandlerOptions, a as ResponseResolver } from './HttpResponse-
|
|
1
|
+
import { D as DefaultBodyType, c as RequestHandlerOptions, a as ResponseResolver } from './HttpResponse-Cy7ytzUn.js';
|
|
2
2
|
import { HttpHandler, HttpRequestResolverExtras } from './handlers/HttpHandler.js';
|
|
3
3
|
import { PathParams, Path } from './utils/matching/matchRequestUrl.js';
|
|
4
|
+
import '@mswjs/interceptors';
|
|
4
5
|
import './utils/internal/isIterable.js';
|
|
5
6
|
import './typeUtils.js';
|
|
6
7
|
|
package/lib/core/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { SetupApi } from './SetupApi.mjs';
|
|
2
|
-
export { A as AsyncResponseResolverReturnType, D as DefaultBodyType, d as DefaultRequestMultipartBody, f as HttpResponse, H as HttpResponseInit, J as JsonBodyType, R as RequestHandler, c as RequestHandlerOptions, a as ResponseResolver, b as ResponseResolverReturnType, S as StrictRequest, e as StrictResponse } from './HttpResponse-
|
|
2
|
+
export { A as AsyncResponseResolverReturnType, D as DefaultBodyType, d as DefaultRequestMultipartBody, f as HttpResponse, H as HttpResponseInit, J as JsonBodyType, R as RequestHandler, c as RequestHandlerOptions, a as ResponseResolver, b as ResponseResolverReturnType, S as StrictRequest, e as StrictResponse } from './HttpResponse-BRDnWbjc.mjs';
|
|
3
3
|
export { HttpRequestHandler, HttpResponseResolver, http } from './http.mjs';
|
|
4
4
|
export { HttpHandler, HttpMethods, HttpRequestParsedResult, RequestQuery } from './handlers/HttpHandler.mjs';
|
|
5
5
|
export { GraphQLRequestHandler, GraphQLResponseResolver, graphql } from './graphql.mjs';
|
|
6
|
-
export { G as GraphQLHandler, d as GraphQLJsonRequestBody, a as GraphQLQuery, c as GraphQLRequestBody, b as GraphQLVariables, P as ParsedGraphQLRequest } from './GraphQLHandler-
|
|
6
|
+
export { G as GraphQLHandler, d as GraphQLJsonRequestBody, a as GraphQLQuery, c as GraphQLRequestBody, b as GraphQLVariables, P as ParsedGraphQLRequest } from './GraphQLHandler-D4_CxZQj.mjs';
|
|
7
7
|
export { WebSocketEventListener, WebSocketLink, ws } from './ws.mjs';
|
|
8
8
|
export { WebSocketHandler, WebSocketHandlerConnection, WebSocketHandlerEventMap } from './handlers/WebSocketHandler.mjs';
|
|
9
9
|
export { Match, Path, PathParams, matchRequestUrl } from './utils/matching/matchRequestUrl.mjs';
|
|
@@ -17,6 +17,7 @@ export { passthrough } from './passthrough.mjs';
|
|
|
17
17
|
export { WebSocketData } from '@mswjs/interceptors/WebSocket';
|
|
18
18
|
import 'strict-event-emitter';
|
|
19
19
|
import './utils/internal/Disposable.mjs';
|
|
20
|
+
import '@mswjs/interceptors';
|
|
20
21
|
import './utils/internal/isIterable.mjs';
|
|
21
22
|
import './typeUtils.mjs';
|
|
22
23
|
import 'graphql';
|
package/lib/core/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { SetupApi } from './SetupApi.js';
|
|
2
|
-
export { A as AsyncResponseResolverReturnType, D as DefaultBodyType, d as DefaultRequestMultipartBody, f as HttpResponse, H as HttpResponseInit, J as JsonBodyType, R as RequestHandler, c as RequestHandlerOptions, a as ResponseResolver, b as ResponseResolverReturnType, S as StrictRequest, e as StrictResponse } from './HttpResponse-
|
|
2
|
+
export { A as AsyncResponseResolverReturnType, D as DefaultBodyType, d as DefaultRequestMultipartBody, f as HttpResponse, H as HttpResponseInit, J as JsonBodyType, R as RequestHandler, c as RequestHandlerOptions, a as ResponseResolver, b as ResponseResolverReturnType, S as StrictRequest, e as StrictResponse } from './HttpResponse-Cy7ytzUn.js';
|
|
3
3
|
export { HttpRequestHandler, HttpResponseResolver, http } from './http.js';
|
|
4
4
|
export { HttpHandler, HttpMethods, HttpRequestParsedResult, RequestQuery } from './handlers/HttpHandler.js';
|
|
5
5
|
export { GraphQLRequestHandler, GraphQLResponseResolver, graphql } from './graphql.js';
|
|
6
|
-
export { G as GraphQLHandler, d as GraphQLJsonRequestBody, a as GraphQLQuery, c as GraphQLRequestBody, b as GraphQLVariables, P as ParsedGraphQLRequest } from './GraphQLHandler-
|
|
6
|
+
export { G as GraphQLHandler, d as GraphQLJsonRequestBody, a as GraphQLQuery, c as GraphQLRequestBody, b as GraphQLVariables, P as ParsedGraphQLRequest } from './GraphQLHandler-Pox7fIFM.js';
|
|
7
7
|
export { WebSocketEventListener, WebSocketLink, ws } from './ws.js';
|
|
8
8
|
export { WebSocketHandler, WebSocketHandlerConnection, WebSocketHandlerEventMap } from './handlers/WebSocketHandler.js';
|
|
9
9
|
export { Match, Path, PathParams, matchRequestUrl } from './utils/matching/matchRequestUrl.js';
|
|
@@ -17,6 +17,7 @@ export { passthrough } from './passthrough.js';
|
|
|
17
17
|
export { WebSocketData } from '@mswjs/interceptors/WebSocket';
|
|
18
18
|
import 'strict-event-emitter';
|
|
19
19
|
import './utils/internal/Disposable.js';
|
|
20
|
+
import '@mswjs/interceptors';
|
|
20
21
|
import './utils/internal/isIterable.js';
|
|
21
22
|
import './typeUtils.js';
|
|
22
23
|
import 'graphql';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { i as HandlersExecutionResult, h as ResponseResolutionContext, j as executeHandlers } from '../HttpResponse-
|
|
1
|
+
export { i as HandlersExecutionResult, h as ResponseResolutionContext, j as executeHandlers } from '../HttpResponse-BRDnWbjc.mjs';
|
|
2
|
+
import '@mswjs/interceptors';
|
|
2
3
|
import './internal/isIterable.mjs';
|
|
3
4
|
import '../typeUtils.mjs';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { i as HandlersExecutionResult, h as ResponseResolutionContext, j as executeHandlers } from '../HttpResponse-
|
|
1
|
+
export { i as HandlersExecutionResult, h as ResponseResolutionContext, j as executeHandlers } from '../HttpResponse-Cy7ytzUn.js';
|
|
2
|
+
import '@mswjs/interceptors';
|
|
2
3
|
import './internal/isIterable.js';
|
|
3
4
|
import '../typeUtils.js';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Emitter } from 'strict-event-emitter';
|
|
2
2
|
import { SharedOptions, LifeCycleEventsMap } from '../sharedOptions.mjs';
|
|
3
3
|
import { RequiredDeep } from '../typeUtils.mjs';
|
|
4
|
-
import { i as HandlersExecutionResult, R as RequestHandler } from '../HttpResponse-
|
|
4
|
+
import { i as HandlersExecutionResult, R as RequestHandler } from '../HttpResponse-BRDnWbjc.mjs';
|
|
5
5
|
import './request/onUnhandledRequest.mjs';
|
|
6
|
+
import '@mswjs/interceptors';
|
|
6
7
|
import './internal/isIterable.mjs';
|
|
7
8
|
|
|
8
9
|
interface HandleRequestOptions {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Emitter } from 'strict-event-emitter';
|
|
2
2
|
import { SharedOptions, LifeCycleEventsMap } from '../sharedOptions.js';
|
|
3
3
|
import { RequiredDeep } from '../typeUtils.js';
|
|
4
|
-
import { i as HandlersExecutionResult, R as RequestHandler } from '../HttpResponse-
|
|
4
|
+
import { i as HandlersExecutionResult, R as RequestHandler } from '../HttpResponse-Cy7ytzUn.js';
|
|
5
5
|
import './request/onUnhandledRequest.js';
|
|
6
|
+
import '@mswjs/interceptors';
|
|
6
7
|
import './internal/isIterable.js';
|
|
7
8
|
|
|
8
9
|
interface HandleRequestOptions {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HandlerKind } from '../../handlers/common.mjs';
|
|
2
|
-
import { R as RequestHandler } from '../../HttpResponse-
|
|
2
|
+
import { R as RequestHandler } from '../../HttpResponse-BRDnWbjc.mjs';
|
|
3
3
|
import { WebSocketHandler } from '../../handlers/WebSocketHandler.mjs';
|
|
4
|
+
import '@mswjs/interceptors';
|
|
4
5
|
import './isIterable.mjs';
|
|
5
6
|
import '../../typeUtils.mjs';
|
|
6
7
|
import 'strict-event-emitter';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HandlerKind } from '../../handlers/common.js';
|
|
2
|
-
import { R as RequestHandler } from '../../HttpResponse-
|
|
2
|
+
import { R as RequestHandler } from '../../HttpResponse-Cy7ytzUn.js';
|
|
3
3
|
import { WebSocketHandler } from '../../handlers/WebSocketHandler.js';
|
|
4
|
+
import '@mswjs/interceptors';
|
|
4
5
|
import './isIterable.js';
|
|
5
6
|
import '../../typeUtils.js';
|
|
6
7
|
import 'strict-event-emitter';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import 'graphql';
|
|
2
|
-
export { j as GraphQLMultipartRequestBody, i as GraphQLParsedOperationsMap, h as ParsedGraphQLQuery, P as ParsedGraphQLRequest, p as parseDocumentNode, k as parseGraphQLRequest } from '../../GraphQLHandler-
|
|
3
|
-
import '../../HttpResponse-
|
|
2
|
+
export { j as GraphQLMultipartRequestBody, i as GraphQLParsedOperationsMap, h as ParsedGraphQLQuery, P as ParsedGraphQLRequest, p as parseDocumentNode, k as parseGraphQLRequest } from '../../GraphQLHandler-D4_CxZQj.mjs';
|
|
3
|
+
import '../../HttpResponse-BRDnWbjc.mjs';
|
|
4
|
+
import '@mswjs/interceptors';
|
|
4
5
|
import './isIterable.mjs';
|
|
5
6
|
import '../../typeUtils.mjs';
|
|
6
7
|
import '../matching/matchRequestUrl.mjs';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import 'graphql';
|
|
2
|
-
export { j as GraphQLMultipartRequestBody, i as GraphQLParsedOperationsMap, h as ParsedGraphQLQuery, P as ParsedGraphQLRequest, p as parseDocumentNode, k as parseGraphQLRequest } from '../../GraphQLHandler-
|
|
3
|
-
import '../../HttpResponse-
|
|
2
|
+
export { j as GraphQLMultipartRequestBody, i as GraphQLParsedOperationsMap, h as ParsedGraphQLQuery, P as ParsedGraphQLRequest, p as parseDocumentNode, k as parseGraphQLRequest } from '../../GraphQLHandler-Pox7fIFM.js';
|
|
3
|
+
import '../../HttpResponse-Cy7ytzUn.js';
|
|
4
|
+
import '@mswjs/interceptors';
|
|
4
5
|
import './isIterable.js';
|
|
5
6
|
import '../../typeUtils.js';
|
|
6
7
|
import '../matching/matchRequestUrl.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { R as RequestHandler, g as RequestHandlerDefaultInfo, c as RequestHandlerOptions } from '../../HttpResponse-
|
|
1
|
+
import { R as RequestHandler, g as RequestHandlerDefaultInfo, c as RequestHandlerOptions } from '../../HttpResponse-BRDnWbjc.mjs';
|
|
2
|
+
import '@mswjs/interceptors';
|
|
2
3
|
import './isIterable.mjs';
|
|
3
4
|
import '../../typeUtils.mjs';
|
|
4
5
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { R as RequestHandler, g as RequestHandlerDefaultInfo, c as RequestHandlerOptions } from '../../HttpResponse-
|
|
1
|
+
import { R as RequestHandler, g as RequestHandlerDefaultInfo, c as RequestHandlerOptions } from '../../HttpResponse-Cy7ytzUn.js';
|
|
2
|
+
import '@mswjs/interceptors';
|
|
2
3
|
import './isIterable.js';
|
|
3
4
|
import '../../typeUtils.js';
|
|
4
5
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { WebSocketConnectionData } from '@mswjs/interceptors/lib/browser/interceptors/WebSocket';
|
|
2
|
-
import { R as RequestHandler } from '../HttpResponse-
|
|
2
|
+
import { R as RequestHandler } from '../HttpResponse-BRDnWbjc.mjs';
|
|
3
3
|
import { WebSocketHandler } from '../handlers/WebSocketHandler.mjs';
|
|
4
4
|
import { UnhandledRequestStrategy } from '../utils/request/onUnhandledRequest.mjs';
|
|
5
|
+
import '@mswjs/interceptors';
|
|
5
6
|
import '../utils/internal/isIterable.mjs';
|
|
6
7
|
import '../typeUtils.mjs';
|
|
7
8
|
import 'strict-event-emitter';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { WebSocketConnectionData } from '@mswjs/interceptors/lib/browser/interceptors/WebSocket';
|
|
2
|
-
import { R as RequestHandler } from '../HttpResponse-
|
|
2
|
+
import { R as RequestHandler } from '../HttpResponse-Cy7ytzUn.js';
|
|
3
3
|
import { WebSocketHandler } from '../handlers/WebSocketHandler.js';
|
|
4
4
|
import { UnhandledRequestStrategy } from '../utils/request/onUnhandledRequest.js';
|
|
5
|
+
import '@mswjs/interceptors';
|
|
5
6
|
import '../utils/internal/isIterable.js';
|
|
6
7
|
import '../typeUtils.js';
|
|
7
8
|
import 'strict-event-emitter';
|
package/lib/iife/index.js
CHANGED
|
@@ -28659,7 +28659,9 @@ Read more: https://mswjs.io/docs/getting-started/mocks`;
|
|
|
28659
28659
|
};
|
|
28660
28660
|
|
|
28661
28661
|
// src/core/HttpResponse.ts
|
|
28662
|
-
var
|
|
28662
|
+
var bodyType = Symbol("bodyType");
|
|
28663
|
+
var HttpResponse = class _HttpResponse extends FetchResponse {
|
|
28664
|
+
[bodyType];
|
|
28663
28665
|
constructor(body, init) {
|
|
28664
28666
|
const responseInit = normalizeResponseInit(init);
|
|
28665
28667
|
super(body, responseInit);
|