Skip to content

Releases: mswjs/interceptors

v0.5.7

03 Dec 09:38
Compare
Choose a tag to compare

Bug fixes

  • Fixes an issue that resulted in XHR requests with a "json" responseType to throw an exception when a mocked response body was missing or wasn't a valid JSON (#75).

v0.5.6

29 Nov 14:07
Compare
Choose a tag to compare

Bug fixes

  • Fixes an issue that resulted in a null mocked response body causing a this.response.length reference exception in XMLHttpRequest (#71. #72).

v0.5.5

26 Nov 10:40
Compare
Choose a tag to compare

Bug fixes

  • Fixes an issue where XMLHttpRequest requests ignored the responseType property when retrieving the mocked response (#69, #70 ). Mocked XMLHttpRequest responses now respect json, blob, and arraybuffer values of the responseType property.

v0.5.4

20 Nov 09:44
Compare
Choose a tag to compare

Bug fixes

  • Fixes an issue that resulted into legacy URL instances not being correctly coerces to the ClientRequest parameters (#63).

v0.5.3

26 Oct 11:40
Compare
Choose a tag to compare

Bug fixes

  • Defaults hostname to localhost if it hasn't been set (#64).

v0.5.2

26 Oct 08:12
Compare
Choose a tag to compare

Bug fixes

  • Resolves URL protocol from http.Agent/https.Agent, if those are set (#62).

v0.5.1

06 Sep 10:06
Compare
Choose a tag to compare

Bug fixes

  • Fixes an issue that resulted into middleware exceptions not being handled properly in XMLHttpRequest instances (mswjs/msw#355, #54). Now any middleware exception first triggers the error event, and only then the abort event.

v0.5.0

25 Aug 11:01
Compare
Choose a tag to compare

Breaking changes

  • Internal: Changes the handling of the original (unpatched) http.ClientRequest class by moving it reference out of the ClientRequestOverride class and restoring it as a part of each individual request handling (#50).

Bug fixes

  • Fixes an issue that resulted into "The superCtor argument must be of type function" error during request interception (#49).

v0.4.0

20 Aug 08:48
Compare
Choose a tag to compare

Breaking changes

  • Creating a new RequestInterceptor instance now requires to pass a list of interceptors to use. It's recommended to use the /presets/default interceptors preset for backwards-compatibility.
import { RequestInterceptor } from 'node-request-interceptor'
+import withDefaultInterceptors from 'node-request-interceptor/presets/default'

-new RequestInterceptor()
+new RequestInterceptor(withDefaultInterceptors)

Features

  • Supports granular interceptors configuration (#48), allowing to specify which request issuing modules to intercept on the usage level. The list of published interceptors:

    • node-request-interceptor/interceptors/ClientRequest
    • node-request-interceptor/interceptors/XMLHttpRequest

To use one or multiple interceptors import them and provide as an argument to RequestInterceptor class:

import { RequestInterceptor } from 'node-request-interceptor'
import { interceptXMLHttpRequest } from 'node-request-interceptor/interceptors/XMLHttpRequest'

const interceptor = new RequestInterceptor([interceptXMLHttpRequest])
interceptor.use(/* refer to README for usage examples */)

Bug fixes

  • Fixes an issue that didn't respect the timeout property on the XMLHttpRequest (#43).
  • Fixes an issue that resulted into broken arguments forwarding when using xhr.open() (#42).

v0.3.6

18 Aug 06:40
Compare
Choose a tag to compare

Changes

ClientRequest

  • options.uri.protocol is taken into account when deciding on the request's protocol.

XMLHttpRequest

  • this.user and this.password initializers are now removed, the values default to undefined.
  • this.async has a default value of undefined, true when forwarded (previously false).

Bug fixes

  • Fixes an issue when the timeout property of an XMLHttpRequest was not propagated to the original request (#47, #43).
  • Fixes an issue when a forwarded xhrRequest.open() call did not have the right async parameter value (#42).