msw 2.10.1 → 2.10.3
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/lib/core/{HttpResponse-BOGtXZ-B.d.mts → HttpResponse-C7FhBLaS.d.mts} +103 -2
- package/lib/core/{HttpResponse-DzeJL_i8.d.ts → HttpResponse-DWu36LsY.d.ts} +103 -2
- package/lib/core/HttpResponse.d.mts +3 -1
- package/lib/core/HttpResponse.d.ts +3 -1
- package/lib/core/HttpResponse.js +5 -1
- package/lib/core/HttpResponse.js.map +1 -1
- package/lib/core/HttpResponse.mjs +5 -1
- package/lib/core/HttpResponse.mjs.map +1 -1
- package/lib/core/SetupApi.d.mts +3 -2
- package/lib/core/SetupApi.d.ts +3 -2
- package/lib/core/getResponse.d.mts +5 -2
- package/lib/core/getResponse.d.ts +5 -2
- package/lib/core/getResponse.js +3 -2
- package/lib/core/getResponse.js.map +1 -1
- package/lib/core/getResponse.mjs +6 -3
- package/lib/core/getResponse.mjs.map +1 -1
- package/lib/core/graphql.d.mts +1 -2
- package/lib/core/graphql.d.ts +1 -2
- package/lib/core/handlers/GraphQLHandler.d.mts +1 -2
- package/lib/core/handlers/GraphQLHandler.d.ts +1 -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 +3 -1
- package/lib/core/handlers/RequestHandler.d.ts +3 -1
- package/lib/core/handlers/RequestHandler.js.map +1 -1
- package/lib/core/handlers/RequestHandler.mjs.map +1 -1
- package/lib/core/handlers/WebSocketHandler.d.mts +6 -2
- package/lib/core/handlers/WebSocketHandler.d.ts +6 -2
- package/lib/core/handlers/WebSocketHandler.js +8 -3
- package/lib/core/handlers/WebSocketHandler.js.map +1 -1
- package/lib/core/handlers/WebSocketHandler.mjs +8 -3
- package/lib/core/handlers/WebSocketHandler.mjs.map +1 -1
- package/lib/core/http.d.mts +2 -1
- package/lib/core/http.d.ts +2 -1
- package/lib/core/index.d.mts +1 -2
- package/lib/core/index.d.ts +1 -2
- package/lib/core/passthrough.d.mts +3 -1
- package/lib/core/passthrough.d.ts +3 -1
- package/lib/core/utils/HttpResponse/decorators.d.mts +3 -1
- package/lib/core/utils/HttpResponse/decorators.d.ts +3 -1
- package/lib/core/utils/executeHandlers.d.mts +3 -1
- package/lib/core/utils/executeHandlers.d.ts +3 -1
- package/lib/core/utils/handleRequest.d.mts +3 -1
- package/lib/core/utils/handleRequest.d.ts +3 -1
- package/lib/core/utils/internal/isHandlerKind.d.mts +3 -2
- package/lib/core/utils/internal/isHandlerKind.d.ts +3 -2
- package/lib/core/utils/internal/parseGraphQLRequest.d.mts +1 -2
- package/lib/core/utils/internal/parseGraphQLRequest.d.ts +1 -2
- package/lib/core/utils/internal/parseMultipartData.d.mts +3 -1
- package/lib/core/utils/internal/parseMultipartData.d.ts +3 -1
- package/lib/core/utils/internal/requestHandlerUtils.d.mts +3 -1
- package/lib/core/utils/internal/requestHandlerUtils.d.ts +3 -1
- package/lib/core/ws/handleWebSocketEvent.d.mts +3 -2
- package/lib/core/ws/handleWebSocketEvent.d.ts +3 -2
- package/lib/iife/index.js +15 -5
- package/lib/iife/index.js.map +1 -1
- package/lib/mockServiceWorker.js +1 -1
- package/package.json +2 -2
- package/src/core/HttpResponse.ts +8 -1
- package/src/core/getResponse.test.ts +28 -17
- package/src/core/getResponse.ts +7 -1
- package/src/core/handlers/RequestHandler.ts +17 -2
- package/src/core/handlers/WebSocketHandler.test.ts +16 -0
- package/src/core/handlers/WebSocketHandler.ts +15 -2
- package/lib/core/GraphQLHandler-DOXAygvT.d.mts +0 -100
- package/lib/core/GraphQLHandler-noP9MRWa.d.ts +0 -100
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { R as RequestHandler,
|
|
1
|
+
import { R as RequestHandler, q as RequestHandlerDefaultInfo, c as RequestHandlerOptions } from '../../HttpResponse-DWu36LsY.js';
|
|
2
2
|
import '@mswjs/interceptors';
|
|
3
3
|
import './isIterable.js';
|
|
4
4
|
import '../../typeUtils.js';
|
|
5
|
+
import 'graphql';
|
|
6
|
+
import '../matching/matchRequestUrl.js';
|
|
5
7
|
|
|
6
8
|
declare function use(currentHandlers: Array<RequestHandler>, ...handlers: Array<RequestHandler>): void;
|
|
7
9
|
declare function restoreHandlers(handlers: Array<RequestHandler>): void;
|
|
@@ -1,13 +1,14 @@
|
|
|
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-C7FhBLaS.mjs';
|
|
3
3
|
import { WebSocketHandler } from '../handlers/WebSocketHandler.mjs';
|
|
4
4
|
import { UnhandledRequestStrategy } from '../utils/request/onUnhandledRequest.mjs';
|
|
5
5
|
import '@mswjs/interceptors';
|
|
6
6
|
import '../utils/internal/isIterable.mjs';
|
|
7
7
|
import '../typeUtils.mjs';
|
|
8
|
+
import 'graphql';
|
|
9
|
+
import '../utils/matching/matchRequestUrl.mjs';
|
|
8
10
|
import 'strict-event-emitter';
|
|
9
11
|
import '@mswjs/interceptors/WebSocket';
|
|
10
|
-
import '../utils/matching/matchRequestUrl.mjs';
|
|
11
12
|
|
|
12
13
|
interface HandleWebSocketEventOptions {
|
|
13
14
|
getUnhandledRequestStrategy: () => UnhandledRequestStrategy;
|
|
@@ -1,13 +1,14 @@
|
|
|
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-DWu36LsY.js';
|
|
3
3
|
import { WebSocketHandler } from '../handlers/WebSocketHandler.js';
|
|
4
4
|
import { UnhandledRequestStrategy } from '../utils/request/onUnhandledRequest.js';
|
|
5
5
|
import '@mswjs/interceptors';
|
|
6
6
|
import '../utils/internal/isIterable.js';
|
|
7
7
|
import '../typeUtils.js';
|
|
8
|
+
import 'graphql';
|
|
9
|
+
import '../utils/matching/matchRequestUrl.js';
|
|
8
10
|
import 'strict-event-emitter';
|
|
9
11
|
import '@mswjs/interceptors/WebSocket';
|
|
10
|
-
import '../utils/matching/matchRequestUrl.js';
|
|
11
12
|
|
|
12
13
|
interface HandleWebSocketEventOptions {
|
|
13
14
|
getUnhandledRequestStrategy: () => UnhandledRequestStrategy;
|
package/lib/iife/index.js
CHANGED
|
@@ -13126,6 +13126,7 @@ ${operationTypes.join("\n")}
|
|
|
13126
13126
|
SetupApi: () => SetupApi,
|
|
13127
13127
|
SetupWorkerApi: () => SetupWorkerApi,
|
|
13128
13128
|
WebSocketHandler: () => WebSocketHandler,
|
|
13129
|
+
bodyType: () => bodyType,
|
|
13129
13130
|
bypass: () => bypass,
|
|
13130
13131
|
cleanUrl: () => cleanUrl,
|
|
13131
13132
|
delay: () => delay,
|
|
@@ -28056,7 +28057,11 @@ Consider naming this operation or using "graphql.operation()" request handler to
|
|
|
28056
28057
|
parse(args) {
|
|
28057
28058
|
const clientUrl = new URL(args.url);
|
|
28058
28059
|
clientUrl.pathname = clientUrl.pathname.replace(/^\/socket.io\//, "/");
|
|
28059
|
-
const match2 = matchRequestUrl(
|
|
28060
|
+
const match2 = matchRequestUrl(
|
|
28061
|
+
clientUrl,
|
|
28062
|
+
this.url,
|
|
28063
|
+
args.resolutionContext?.baseUrl
|
|
28064
|
+
);
|
|
28060
28065
|
return {
|
|
28061
28066
|
match: match2
|
|
28062
28067
|
};
|
|
@@ -28064,9 +28069,10 @@ Consider naming this operation or using "graphql.operation()" request handler to
|
|
|
28064
28069
|
predicate(args) {
|
|
28065
28070
|
return args.parsedResult.match.matches;
|
|
28066
28071
|
}
|
|
28067
|
-
async run(connection) {
|
|
28072
|
+
async run(connection, resolutionContext) {
|
|
28068
28073
|
const parsedResult = this.parse({
|
|
28069
|
-
url: connection.client.url
|
|
28074
|
+
url: connection.client.url,
|
|
28075
|
+
resolutionContext
|
|
28070
28076
|
});
|
|
28071
28077
|
if (!this.predicate({ url: connection.client.url, parsedResult })) {
|
|
28072
28078
|
return false;
|
|
@@ -28718,11 +28724,12 @@ Read more: https://mswjs.io/docs/http/intercepting-requests`;
|
|
|
28718
28724
|
}
|
|
28719
28725
|
|
|
28720
28726
|
// src/core/getResponse.ts
|
|
28721
|
-
var getResponse = async (handlers, request) => {
|
|
28727
|
+
var getResponse = async (handlers, request, resolutionContext) => {
|
|
28722
28728
|
const result = await executeHandlers({
|
|
28723
28729
|
request,
|
|
28724
28730
|
requestId: createRequestId(),
|
|
28725
|
-
handlers
|
|
28731
|
+
handlers,
|
|
28732
|
+
resolutionContext
|
|
28726
28733
|
});
|
|
28727
28734
|
return result?.response;
|
|
28728
28735
|
};
|
|
@@ -28736,6 +28743,9 @@ Read more: https://mswjs.io/docs/http/intercepting-requests`;
|
|
|
28736
28743
|
super(body, responseInit);
|
|
28737
28744
|
decorateResponse(this, responseInit);
|
|
28738
28745
|
}
|
|
28746
|
+
static error() {
|
|
28747
|
+
return super.error();
|
|
28748
|
+
}
|
|
28739
28749
|
/**
|
|
28740
28750
|
* Create a `Response` with a `Content-Type: "text/plain"` body.
|
|
28741
28751
|
* @example
|