msw 2.10.2 → 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.
Files changed (56) hide show
  1. package/lib/core/{HttpResponse-I457nh8V.d.mts → HttpResponse-C7FhBLaS.d.mts} +1 -1
  2. package/lib/core/{HttpResponse-CCdkF1fJ.d.ts → HttpResponse-DWu36LsY.d.ts} +1 -1
  3. package/lib/core/HttpResponse.d.mts +1 -1
  4. package/lib/core/HttpResponse.d.ts +1 -1
  5. package/lib/core/SetupApi.d.mts +1 -1
  6. package/lib/core/SetupApi.d.ts +1 -1
  7. package/lib/core/getResponse.d.mts +3 -2
  8. package/lib/core/getResponse.d.ts +3 -2
  9. package/lib/core/getResponse.js +3 -2
  10. package/lib/core/getResponse.js.map +1 -1
  11. package/lib/core/getResponse.mjs +6 -3
  12. package/lib/core/getResponse.mjs.map +1 -1
  13. package/lib/core/graphql.d.mts +1 -1
  14. package/lib/core/graphql.d.ts +1 -1
  15. package/lib/core/handlers/GraphQLHandler.d.mts +1 -1
  16. package/lib/core/handlers/GraphQLHandler.d.ts +1 -1
  17. package/lib/core/handlers/HttpHandler.d.mts +1 -1
  18. package/lib/core/handlers/HttpHandler.d.ts +1 -1
  19. package/lib/core/handlers/RequestHandler.d.mts +1 -1
  20. package/lib/core/handlers/RequestHandler.d.ts +1 -1
  21. package/lib/core/handlers/WebSocketHandler.d.mts +6 -2
  22. package/lib/core/handlers/WebSocketHandler.d.ts +6 -2
  23. package/lib/core/handlers/WebSocketHandler.js +8 -3
  24. package/lib/core/handlers/WebSocketHandler.js.map +1 -1
  25. package/lib/core/handlers/WebSocketHandler.mjs +8 -3
  26. package/lib/core/handlers/WebSocketHandler.mjs.map +1 -1
  27. package/lib/core/http.d.mts +1 -1
  28. package/lib/core/http.d.ts +1 -1
  29. package/lib/core/index.d.mts +1 -1
  30. package/lib/core/index.d.ts +1 -1
  31. package/lib/core/passthrough.d.mts +1 -1
  32. package/lib/core/passthrough.d.ts +1 -1
  33. package/lib/core/utils/HttpResponse/decorators.d.mts +1 -1
  34. package/lib/core/utils/HttpResponse/decorators.d.ts +1 -1
  35. package/lib/core/utils/executeHandlers.d.mts +1 -1
  36. package/lib/core/utils/executeHandlers.d.ts +1 -1
  37. package/lib/core/utils/handleRequest.d.mts +1 -1
  38. package/lib/core/utils/handleRequest.d.ts +1 -1
  39. package/lib/core/utils/internal/isHandlerKind.d.mts +1 -1
  40. package/lib/core/utils/internal/isHandlerKind.d.ts +1 -1
  41. package/lib/core/utils/internal/parseGraphQLRequest.d.mts +1 -1
  42. package/lib/core/utils/internal/parseGraphQLRequest.d.ts +1 -1
  43. package/lib/core/utils/internal/parseMultipartData.d.mts +1 -1
  44. package/lib/core/utils/internal/parseMultipartData.d.ts +1 -1
  45. package/lib/core/utils/internal/requestHandlerUtils.d.mts +1 -1
  46. package/lib/core/utils/internal/requestHandlerUtils.d.ts +1 -1
  47. package/lib/core/ws/handleWebSocketEvent.d.mts +1 -1
  48. package/lib/core/ws/handleWebSocketEvent.d.ts +1 -1
  49. package/lib/iife/index.js +11 -5
  50. package/lib/iife/index.js.map +1 -1
  51. package/lib/mockServiceWorker.js +1 -1
  52. package/package.json +2 -2
  53. package/src/core/getResponse.test.ts +28 -17
  54. package/src/core/getResponse.ts +7 -1
  55. package/src/core/handlers/WebSocketHandler.test.ts +16 -0
  56. package/src/core/handlers/WebSocketHandler.ts +15 -2
package/lib/iife/index.js CHANGED
@@ -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(clientUrl, this.url);
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
  };