Skip to content

Releases: sindresorhus/got

2.7.2

08 Apr 19:05
Compare
Choose a tag to compare

Fixed absent nested error on parse error of response.

v2.7.1...v2.7.2

2.7.1

08 Apr 11:05
Compare
Choose a tag to compare

Parse response with non-2xx status code, when json option is true.

v2.7.0...v2.7.1

2.7.0

06 Apr 11:34
Compare
Choose a tag to compare

New json option for auto-parsing JSON response. abdd0f0

Before:

got('jsonendpoint.com', function (err, data) {
    if (err) { return cb(err); }

    var json;

    try {
        json = JSON.parse(data);
    } catch (e) {
        return cb(new Error('Reponse from jsonendpoint.com is broken: ' + e.message));
    }

    // working with json
});

After:

got('jsonendpoint.com', {json: true}, function (err, json) {
    if (err) { return cb(err); }

    // working with json
});

v2.6.0...v2.7.0

2.6.0

03 Apr 14:59
Compare
Choose a tag to compare

Thanks to nested-error-stacks by @mdlavin got now emits much more detailed errors! For example Error: getaddrinfo ENOTFOUND now looks like:

GotError: Request to .com failed
    at ClientRequest.<anonymous> (index.js:123:7)
    at ClientRequest.g (events.js:180:16)
    at ClientRequest.emit (events.js:95:17)
    at Socket.socketErrorListener (http.js:1552:9)
    at Socket.emit (events.js:95:17)
    at net.js:834:16
    at process._tickCallback (node.js:442:13)
Caused By: Error: getaddrinfo ENOTFOUND
    at errnoException (dns.js:37:11)
    at Object.onanswer [as oncomplete] (dns.js:124:16)

Same goes for ungzip errors and response stream reading errors. All of them will be wrapped in GotError with url in message.

Highlights

  • read-all-stream was updated to ^2.0.0 - release fixes hanging requests on error in underlying streams (like ungzip) 3e55aa6

Changes

v2.5.0...v2.6.0

2.5.0

24 Mar 18:51
Compare
Choose a tag to compare

Emit response event with response object in Stream mode, when server response is ready. 929cb59

v2.4.0...v2.5.0

2.4.0

06 Feb 09:23
Compare
Choose a tag to compare

Improve status code error messages. ef8bdeb

v2.3.2...v2.4.0

2.3.2

24 Jan 08:02
Compare
Choose a tag to compare

Prevent duplicate headers of different casing. Node will throw if it encounters that.

v2.3.1...v2.3.2

2.3.1

19 Jan 13:00
Compare
Choose a tag to compare

2.3.0 - funkadelic-bear

05 Jan 09:54
Compare
Choose a tag to compare

tumblr_mzkfuyhmyr1s373hwo1_400

Update

$ npm update --save got

Highlights

  • Add readable stream support in options.body. 7693a7d
  • Support protocol-less URLs as input. 0b6d7da
  • Use agents with maxSockets set to Infinity. #22 5d5d0cc
  • Discard response payload on redirect response. 1f9281f

Changes

v2.2.0...v2.3.0

2.0.0

23 Nov 09:01
Compare
Choose a tag to compare
  • Return an error object on connection failure instead of the HTTP status code. 4a6b6d7
    The HTTP status code is now available as a code property on the error object.
  • Read response stream even if status is not 200. cef2daa
    If you only care about the returned status code make sure to do a HEAD request.
  • Add timeout option. 14e0dd8