msw 2.10.2 → 2.10.4
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-I457nh8V.d.mts → HttpResponse-C7FhBLaS.d.mts} +1 -1
- package/lib/core/{HttpResponse-CCdkF1fJ.d.ts → HttpResponse-DWu36LsY.d.ts} +1 -1
- package/lib/core/HttpResponse.d.mts +1 -1
- package/lib/core/HttpResponse.d.ts +1 -1
- package/lib/core/SetupApi.d.mts +1 -1
- package/lib/core/SetupApi.d.ts +1 -1
- package/lib/core/getResponse.d.mts +3 -2
- package/lib/core/getResponse.d.ts +3 -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 -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/HttpHandler.js +1 -1
- package/lib/core/handlers/HttpHandler.js.map +1 -1
- package/lib/core/handlers/HttpHandler.mjs +1 -1
- package/lib/core/handlers/HttpHandler.mjs.map +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.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 +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/passthrough.d.mts +1 -1
- package/lib/core/passthrough.d.ts +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/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/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/utils/internal/requestHandlerUtils.d.mts +1 -1
- package/lib/core/utils/internal/requestHandlerUtils.d.ts +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 +12 -6
- package/lib/iife/index.js.map +1 -1
- package/lib/mockServiceWorker.js +1 -1
- package/package.json +2 -2
- package/src/core/getResponse.test.ts +28 -17
- package/src/core/getResponse.ts +7 -1
- package/src/core/handlers/HttpHandler.ts +1 -1
- package/src/core/handlers/WebSocketHandler.test.ts +16 -0
- package/src/core/handlers/WebSocketHandler.ts +15 -2
|
@@ -1,7 +1,7 @@
|
|
|
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 { r as HandlersExecutionResult, R as RequestHandler } from '../HttpResponse-
|
|
4
|
+
import { r as HandlersExecutionResult, R as RequestHandler } from '../HttpResponse-DWu36LsY.js';
|
|
5
5
|
import './request/onUnhandledRequest.js';
|
|
6
6
|
import '@mswjs/interceptors';
|
|
7
7
|
import './internal/isIterable.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HandlerKind } from '../../handlers/common.mjs';
|
|
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 '@mswjs/interceptors';
|
|
5
5
|
import './isIterable.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HandlerKind } from '../../handlers/common.js';
|
|
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 '@mswjs/interceptors';
|
|
5
5
|
import './isIterable.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'graphql';
|
|
2
|
-
export { w as GraphQLMultipartRequestBody, v as GraphQLParsedOperationsMap, t as ParsedGraphQLQuery, P as ParsedGraphQLRequest, u as parseDocumentNode, x as parseGraphQLRequest } from '../../HttpResponse-
|
|
2
|
+
export { w as GraphQLMultipartRequestBody, v as GraphQLParsedOperationsMap, t as ParsedGraphQLQuery, P as ParsedGraphQLRequest, u as parseDocumentNode, x as parseGraphQLRequest } from '../../HttpResponse-C7FhBLaS.mjs';
|
|
3
3
|
import '@mswjs/interceptors';
|
|
4
4
|
import './isIterable.mjs';
|
|
5
5
|
import '../../typeUtils.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'graphql';
|
|
2
|
-
export { w as GraphQLMultipartRequestBody, v as GraphQLParsedOperationsMap, t as ParsedGraphQLQuery, P as ParsedGraphQLRequest, u as parseDocumentNode, x as parseGraphQLRequest } from '../../HttpResponse-
|
|
2
|
+
export { w as GraphQLMultipartRequestBody, v as GraphQLParsedOperationsMap, t as ParsedGraphQLQuery, P as ParsedGraphQLRequest, u as parseDocumentNode, x as parseGraphQLRequest } from '../../HttpResponse-DWu36LsY.js';
|
|
3
3
|
import '@mswjs/interceptors';
|
|
4
4
|
import './isIterable.js';
|
|
5
5
|
import '../../typeUtils.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RequestHandler,
|
|
1
|
+
import { R as RequestHandler, q as RequestHandlerDefaultInfo, c as RequestHandlerOptions } from '../../HttpResponse-C7FhBLaS.mjs';
|
|
2
2
|
import '@mswjs/interceptors';
|
|
3
3
|
import './isIterable.mjs';
|
|
4
4
|
import '../../typeUtils.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
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';
|
|
@@ -1,5 +1,5 @@
|
|
|
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';
|
|
@@ -1,5 +1,5 @@
|
|
|
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';
|
package/lib/iife/index.js
CHANGED
|
@@ -27168,7 +27168,7 @@ ${operationTypes.join("\n")}
|
|
|
27168
27168
|
queryParams.push(paramName);
|
|
27169
27169
|
});
|
|
27170
27170
|
devUtils.warn(
|
|
27171
|
-
`Found a redundant usage of query parameters in the request handler URL for "${method} ${path}". Please match against a path instead and access query parameters using "new URL(request.url).searchParams" instead. Learn more: https://mswjs.io/docs/http/intercepting-
|
|
27171
|
+
`Found a redundant usage of query parameters in the request handler URL for "${method} ${path}". Please match against a path instead and access query parameters using "new URL(request.url).searchParams" instead. Learn more: https://mswjs.io/docs/http/intercepting-requests#querysearch-parameters`
|
|
27172
27172
|
);
|
|
27173
27173
|
}
|
|
27174
27174
|
async parse(args) {
|
|
@@ -28057,7 +28057,11 @@ Consider naming this operation or using "graphql.operation()" request handler to
|
|
|
28057
28057
|
parse(args) {
|
|
28058
28058
|
const clientUrl = new URL(args.url);
|
|
28059
28059
|
clientUrl.pathname = clientUrl.pathname.replace(/^\/socket.io\//, "/");
|
|
28060
|
-
const match2 = matchRequestUrl(
|
|
28060
|
+
const match2 = matchRequestUrl(
|
|
28061
|
+
clientUrl,
|
|
28062
|
+
this.url,
|
|
28063
|
+
args.resolutionContext?.baseUrl
|
|
28064
|
+
);
|
|
28061
28065
|
return {
|
|
28062
28066
|
match: match2
|
|
28063
28067
|
};
|
|
@@ -28065,9 +28069,10 @@ Consider naming this operation or using "graphql.operation()" request handler to
|
|
|
28065
28069
|
predicate(args) {
|
|
28066
28070
|
return args.parsedResult.match.matches;
|
|
28067
28071
|
}
|
|
28068
|
-
async run(connection) {
|
|
28072
|
+
async run(connection, resolutionContext) {
|
|
28069
28073
|
const parsedResult = this.parse({
|
|
28070
|
-
url: connection.client.url
|
|
28074
|
+
url: connection.client.url,
|
|
28075
|
+
resolutionContext
|
|
28071
28076
|
});
|
|
28072
28077
|
if (!this.predicate({ url: connection.client.url, parsedResult })) {
|
|
28073
28078
|
return false;
|
|
@@ -28719,11 +28724,12 @@ Read more: https://mswjs.io/docs/http/intercepting-requests`;
|
|
|
28719
28724
|
}
|
|
28720
28725
|
|
|
28721
28726
|
// src/core/getResponse.ts
|
|
28722
|
-
var getResponse = async (handlers, request) => {
|
|
28727
|
+
var getResponse = async (handlers, request, resolutionContext) => {
|
|
28723
28728
|
const result = await executeHandlers({
|
|
28724
28729
|
request,
|
|
28725
28730
|
requestId: createRequestId(),
|
|
28726
|
-
handlers
|
|
28731
|
+
handlers,
|
|
28732
|
+
resolutionContext
|
|
28727
28733
|
});
|
|
28728
28734
|
return result?.response;
|
|
28729
28735
|
};
|