Skip to content

v0.4.0

Compare
Choose a tag to compare
@kettanaito kettanaito released this 20 Aug 08:48

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).