Releases: sindresorhus/got
Releases · sindresorhus/got
2.9.0
Validation
Options
url
now acceptshttp.request
options as first argument 47da118query
option added 53df1ca
2.8.0
- Don't mutate the user-supplied options object ae73837
- infinity-agent updated to
2.0.0
- which uses backported Agent from Node core c06d741- Every request (in Node 0.10) will now have
Connection: close
header instead ofConnection: keep-alive
.maxSockets
is nowInfinity
always - if you want different value, passnull
or new Agent instance.
- Every request (in Node 0.10) will now have
2.7.2
Fixed absent nested error on parse error of response.
2.7.1
Parse response with non-2xx status code, when json
option is true
.
2.7.0
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
});
2.6.0
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
2.5.0
Emit response
event with response object in Stream mode, when server response is ready. 929cb59
2.4.0
Improve status code error messages. ef8bdeb
2.3.2
Prevent duplicate headers of different casing. Node will throw if it encounters that.