Skip to content

Releases: mswjs/interceptors

v0.10.0

12 May 11:03
Compare
Choose a tag to compare

Breaking changes

  • http.ClientRequest class is no longer monkey-patched to prevent a memory leak (#116).

Bug fixes

  • Fixes an issue that resulted in a valid XML response body not being accessible in xmlHttpRequest.responseXML (#117).

v0.9.0

22 Apr 14:04
Compare
Choose a tag to compare

Breaking changes

  • (Internal) Determines a URL passed as an argument to ClientRequest based on instanceof URL (#114).

v0.8.1

24 Mar 12:22
Compare
Choose a tag to compare

Bug fixes

  • Removes TypeScript declarations that contained a typo (#106).
-import { IsomorphicRequest, IsomophricResponse } from '@mswjs/interceptors'
+import { IsomorphicRequest, IsomorphicResponse } from '@mswjs/interceptors'

v0.8.0

23 Mar 13:10
Compare
Choose a tag to compare

Breaking changes

createInterceptor({
  modules: [...],
  resolver(request) {
-    request.headers['accept']
+    request.headers.get('accept')
  }
})

v0.7.0

23 Mar 15:04
Compare
Choose a tag to compare

Breaking changes

  • The package has been renamed to @mswjs/interceptors (#104).
  • RequestInterceptor class has been removed in favor of createInterceptor 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

03 Jan 08:53
Compare
Choose a tag to compare

Changes

  • ClientRequest: MockedResponse.body can now be undefined.

Bug fixes

  • Fixes an issue where the response event callback annotated the res argument as a Partial<MockedResponse>. Now the returned res argument is a full MockedResponse object (#82, #84).

v0.6.2

20 Dec 10:23
Compare
Choose a tag to compare

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

18 Dec 15:43
Compare
Choose a tag to compare

Bug fixes

  • Fixes an issue that prevented the XMLHttpRequest request headers not being propagated to the request instance in case of the original (bypassed) response (#83).

v0.6.0

18 Dec 09:46
Compare
Choose a tag to compare

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 the response event.

v0.5.9

08 Dec 20:31
Compare
Choose a tag to compare

Bug fixes

  • Fixes a memory leak caused by a wrong usage of the internal debug utility (#77).
  • Fixes a memory leak caused by a wrong inheritance of the original ClientRequest instance (#77).