msw 2.7.0 → 2.7.1
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-C5CUIS_N.d.ts → GraphQLHandler-B2C8S1zW.d.ts} +1 -1
- package/lib/core/{GraphQLHandler-CLv2BIIm.d.mts → GraphQLHandler-DYshTG2D.d.mts} +1 -1
- package/lib/core/{HttpResponse-CFPhtDH3.d.mts → HttpResponse-3ReBq-Rf.d.mts} +3 -2
- package/lib/core/{HttpResponse-5Sn2vNaJ.d.ts → HttpResponse-BPOVeNkE.d.ts} +3 -2
- package/lib/core/HttpResponse.d.mts +2 -1
- package/lib/core/HttpResponse.d.ts +2 -1
- package/lib/core/HttpResponse.js +2 -1
- package/lib/core/HttpResponse.js.map +1 -1
- package/lib/core/HttpResponse.mjs +2 -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 +1 -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 +3 -2
- package/src/core/utils/handleRequest.test.ts +1 -1
package/lib/mockServiceWorker.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - Please do NOT serve this file on production.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
const PACKAGE_VERSION = '2.7.
|
|
11
|
+
const PACKAGE_VERSION = '2.7.1'
|
|
12
12
|
const INTEGRITY_CHECKSUM = '00729d72e3b82faf54ca8b9621dbb96f'
|
|
13
13
|
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
|
|
14
14
|
const activeClientIds = new Set()
|
package/package.json
CHANGED
|
@@ -13,6 +13,10 @@ it('creates a plain response', async () => {
|
|
|
13
13
|
expect(Object.fromEntries(response.headers.entries())).toEqual({})
|
|
14
14
|
})
|
|
15
15
|
|
|
16
|
+
it('supports non-configurable status codes', () => {
|
|
17
|
+
expect(new HttpResponse(null, { status: 101 })).toHaveProperty('status', 101)
|
|
18
|
+
})
|
|
19
|
+
|
|
16
20
|
describe('HttpResponse.text()', () => {
|
|
17
21
|
it('creates a text response', async () => {
|
|
18
22
|
const response = HttpResponse.text('hello world', { status: 201 })
|
package/src/core/HttpResponse.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FetchResponse } from '@mswjs/interceptors'
|
|
1
2
|
import type { DefaultBodyType, JsonBodyType } from './handlers/RequestHandler'
|
|
2
3
|
import type { NoInfer } from './typeUtils'
|
|
3
4
|
import {
|
|
@@ -35,7 +36,7 @@ export interface StrictResponse<BodyType extends DefaultBodyType>
|
|
|
35
36
|
*
|
|
36
37
|
* @see {@link https://mswjs.io/docs/api/http-response `HttpResponse` API reference}
|
|
37
38
|
*/
|
|
38
|
-
export class HttpResponse extends
|
|
39
|
+
export class HttpResponse extends FetchResponse {
|
|
39
40
|
constructor(body?: BodyInit | null, init?: HttpResponseInit) {
|
|
40
41
|
const responseInit = normalizeResponseInit(init)
|
|
41
42
|
super(body, responseInit)
|
|
@@ -167,7 +168,7 @@ export class HttpResponse extends Response {
|
|
|
167
168
|
responseInit.headers.set('Content-Length', body.byteLength.toString())
|
|
168
169
|
}
|
|
169
170
|
|
|
170
|
-
return new HttpResponse(body, responseInit)
|
|
171
|
+
return new HttpResponse(body as ArrayBuffer, responseInit)
|
|
171
172
|
}
|
|
172
173
|
|
|
173
174
|
/**
|
|
@@ -84,7 +84,7 @@ test('does not bypass a request with "accept: msw/*" header set to arbitrary val
|
|
|
84
84
|
|
|
85
85
|
const request = new Request(new URL('http://localhost/user'), {
|
|
86
86
|
headers: new Headers({
|
|
87
|
-
|
|
87
|
+
accept: 'msw/invalid',
|
|
88
88
|
}),
|
|
89
89
|
})
|
|
90
90
|
const handlers: Array<RequestHandler> = [
|