Releases: mswjs/interceptors
Releases · mswjs/interceptors
v0.10.0
v0.9.0
v0.8.1
v0.8.0
Breaking changes
- Isomorphic request headers are now an instance of HeadersPolyfill (#105 ).
createInterceptor({
modules: [...],
resolver(request) {
- request.headers['accept']
+ request.headers.get('accept')
}
})
v0.7.0
Breaking changes
- The package has been renamed to
@mswjs/interceptors
(#104). RequestInterceptor
class has been removed in favor ofcreateInterceptor
function (#92).
-import { RequestInterceptor } from 'node-request-interceptor'
-import nodeInterceptors from 'node-request-interceptor/lib/presets/node'
+import { createInterceptor } from '@mswjs/interceptors'
+import nodeInterceptors from '@mswjs/interceptors/lib/presets/node'
-const interceptor = new RequestInterceptor()
-interceptor.use((request) => {})
+const interceptor = createInterceptor({
+ modules: nodeInterceptors
+ resolver(request) {}
v0.6.3
v0.6.2
Bug fixes
- Fixes an issue where
XMLHttpRequest
class didn't have the ready state static properties (UNSENT
,OPENED
, etc.) once request interception was in place (#81). Now those ready state properties are available as static properties per specification:
XMLHttpRequest.UNSENT // 0
XMLHttpRequest.OPENED // 1
XMLHttpRequest.HEADERS_RECEIVED // 2
XMLHttpRequest.LOADING // 3
XMLHttpRequest.DONE // 4
v0.6.1
v0.6.0
Features
- Adds the event emitter to listen to internal events. Supports the
response
event fired upon any mocked/original response.
import { RequestInterceptor } from 'node-request-interceptor'
const interceptor = new RequestInterceptor(interceptors)
interceptor.on('response', (req, res) => {})
Note that you cannot affect
req
/res
in theresponse
event.