Skip to content

Releases: bbc/http-transport

v4.2.0

27 Sep 13:19
Compare
Choose a tag to compare

feat: adds proxy support 060a6ba
v4.1.1...v4.2.0

v4.1.1

26 Sep 08:50
Compare
Choose a tag to compare
  • use CJS version of node-fetch to avoid jest integration issues 7fb0c64

v4.1.0...v4.1.1

v4.1.0

26 Sep 08:34
Compare
Choose a tag to compare
  • fix: correct types for FetchTransport 3eb9414
  • refactor: make the type of the next parameter for Plugins easier to read f57d5e5
  • fix: rename Response.toJson to Response.toJSON in the types, so that they actually match the code bb58241

v4.0.1...v4.1.0

v4.0.1

25 Sep 10:45
Compare
Choose a tag to compare
  • test: add unit tests for conversion of response to json a5af740

v4.0.0...v4.0.1

v4.0.0

22 Sep 14:29
Compare
Choose a tag to compare

Release Notes

This major change replaces the deprecated Request library with node-fetch, since Request contains a Server-side Request Forgery (SSRF) vulnerability with no fix expected.

Key Changes:

  • Setting of default behaviour of underlying transport layer is now done by passing in a configuration object, as opposed to passing in a configured instance of request. This removes coupling of the underlying transport layer, and your usage of http-transport. See below for more detail.
  • The httpResponse object is now returned from node-fetch rather than Request, meaning that it is different in structure. The rest of the response is left unchanged from v3.5.6.
  • The asCallback() function has been removed from the HttpTransportBuilder. Callbackifying the client can still be achieved using the [http-transport-callbacks](https://github.com/bbc/http-transport-callbacks) plugin.

Example of setting defaults:

    const url = 'http://example.com/';
    const HttpTransport = require('@bbc/http-transport');
    const defaultConfig = {
        agentOpts: { // Here you can pass in any options for the https agent https://nodejs.org/api/https.html#class-httpsagent
            keepAlive: true,
            maxSockets: 1000
        }, 
        defaults: {
            json: true, // parses the response body as json, if false response body will be left as text
            timeout: 2000 // sets timeout for each request
            compress: true // support gzip/deflate content encoding. false to disable
        }
    };
    const requestTransport = new HttpTransport.RequestTransport(defaultConfig);
    const res = await HttpTransport.createClient(requestTransport);
        .get(url)
        .asResponse();
        if (res.statusCode === 200) {
            console.log(res.body);
        }

Note: Before this major version, setting defaults was done by passing in a configured instance of request, this meant that you could use any of requests options. This is no longer the case, however we have kept the same functionality for any of the features used in ibl.
v4.0.0-2...v4.0.0

v4.0.0-2

21 Sep 13:03
Compare
Choose a tag to compare
v4.0.0-2 Pre-release
Pre-release
  • catches error if JSON parsing fails, and defaults response to text a72a892

v4.0.0-1...v4.0.0-2

v4.0.0-1

21 Sep 08:37
Compare
Choose a tag to compare
v4.0.0-1 Pre-release
Pre-release
  • parse body as json if json default is set 2f68d8e

v4.0.0-0...v4.0.0-1

v4.0.0-0

20 Sep 11:18
Compare
Choose a tag to compare
v4.0.0-0 Pre-release
Pre-release
  • default to from.text() if content type is not json 27c5bf3

v3.5.7-3...v4.0.0-0

v3.5.7-3

19 Sep 13:14
Compare
Choose a tag to compare
v3.5.7-3 Pre-release
Pre-release
  • converts headers from iterable to serializable object, fixes leak in tests 5d682f5

v3.5.7-2...v3.5.7-3

v3.5.7-2

18 Sep 15:14
Compare
Choose a tag to compare
v3.5.7-2 Pre-release
Pre-release

v3.5.7-1...v3.5.7-2