Skip to content

Releases: sindresorhus/got

6.1.0

16 Jan 11:32
Compare
Choose a tag to compare

Non-retrieable errors

In got@5 we introduced retries option, which (as name says) retry request on every Error. For most errors this was right thing to do, but in case ENETUNREACH and ENOTFOUND retries are pointless.

This version removes retries from such errors, so you will get instant error, when typo gets into configs.

Changes

v6.0.0...v6.1.0

5.3.1

12 Jan 10:46
Compare
Choose a tag to compare
  • 43a6ea5 Missing exception in helper methods for stream mode.
  • 436600f Fixed piping response in response event for stream mode.

v5.3.0...v5.3.1

6.0.0

07 Jan 18:58
Compare
Choose a tag to compare

Aiming on Node.js 4

This release drops Node.js 0.10/0.12 support, so we replaced lots of modules and reduce dependency tree more than twice (see PR overview). Module folder size reduced from 1.1 MB to 216 KB.

For older Node.js versions we will still maintain v5.x for critical bug-fixes.

Promises by default

Callback interface was replaced by Promises, because it is a better way to work with asynchronous operations and they can be used with yield/await nicely.

If you use callback before:

got('todomvc.com', (err, body) => {
    if (err) {
        console.log(err);
        return;
    }

    console.log(body);
});

You can rewrite it this way:

got('todomvc.com')
    .then(res => {
        console.log(res.body);
    })
    .catch(err => {
        console.log(err);
    });

You can read more about Promises in "ECMAScript 6 promises (2/2): the API" post and some caveats in "We have a problem with promises".

Update

$ npm install --save got@6

Changes

v5.3.0...v6.0.0

5.3.0

20 Dec 17:29
Compare
Choose a tag to compare
  • 59aa1d3 Error is passed to retries function as well
  • da9fc07 Unzipping HEAD requests is disabled

v5.2.0...v5.3.0

5.2.0

02 Dec 07:57
Compare
Choose a tag to compare
  • 54bd6f5 default intervals between delays decreased - now they are around 1s, 2s, 4s, 8s, etc...
  • a10a99e retries option accepts backoff function, for example you can:
// Constant delay of 10ms for 5 iterations
got('google.com', {
    retries: iter => iter < 5 && 10
});

// Infinity retries with constant delay
got('google.com', {
    retries: () => 10
});

v5.1.0...v5.2.0

5.1.0

04 Nov 06:18
Compare
Choose a tag to compare
  • 5205e72 body option now accepts Stream1 streams
  • e45087a content-length and accept headers now can be falsy values ('' or 0 for example)
  • dcc7de6 response property is now non-enumerable in error object
  • cf54459 undefined value of code property in error removed

v5.0.0...v5.1.0

5.0.0

18 Oct 09:45
Compare
Choose a tag to compare

zjvxrhf

Retries

We added retries on network failures with noisy exponential backoff. By default got will try five times, before returning error.

Retries only applies to network errors (because network is not reliable). Requests with server errors, like 50x status codes, will not be retried.

You can disable them by passing 0 to retries option.

Update

$ npm install --save got@5

Highlights

Changes

v4.2.0...v5.0.0

4.2.0

09 Sep 09:02
Compare
Choose a tag to compare
  • e944467 improves error message on invalid JSON
  • e0863dc enable errors in stream mode (#97)
  • 3182234 allow requests via domain sockets

v4.1.1...v4.2.0

4.1.1

28 Jul 15:03
Compare
Choose a tag to compare
  • bdc1bfb fixes crashes on RequestError in Promise mode

v4.1.0...v4.1.1

4.1.0 - x-www-form-urlencoded

27 Jul 11:15
Compare
Choose a tag to compare
  • 7bea9c4 If body is a plain Object, it will be stringified and sent as application/x-www-form-urlencoded.

v4.0.0...v4.1.0