Closed mikicho closed 1 year ago
Also for 101, 103, 204, 205, or 304. https://fetch.spec.whatwg.org/#statuses
I've opened a fix for this in #436. @mikicho, note that while status codes 101 and 103 also forbid response from having a body, you cannot even construct responses with those status codes. The ResponseInit.status
expects a [200, 599] status code range.
new Response(null, { status: 101 })
// Uncaught RangeError: Failed to construct 'Response': The status provided (101) is outside the range [200, 599].
The library won't account for those status codes because it's unnecessary.
This has been released in v0.25.3!
Make sure to always update to the latest version (npm i @mswjs/interceptors@latest
) to get the newest features and bug fixes.
Predictable release automation by @ossjs/release.
https://github.com/mswjs/interceptors/blob/main/src/interceptors/ClientRequest/utils/createResponse.ts#L21