github sindresorhus/got v3.0.0


52490b2e88f263ab8abfb9498cb65575f3a15b01 New redirect event

This event fired before any redirect with response and nextOptions objects. You can access cookies and store them to be passed with next request in nextOptions.

    .on('redirect', function (res, nextOptions) {
        nextOptions.headers.cookie = cookie(res);

Breaking changes

2302a1e6e584f0b4a64bc6c0b16c72c645cd3cb7 Redirects enabled only for GET and HEAD methods

As rfc2616 HTTP 1.1 says:

If the 302 status code is received in response to a request other
than GET or HEAD, the user agent MUST NOT automatically redirect the
request unless it can be confirmed by the user, since this might
change the conditions under which the request was issued.

Now got will not auto-redirect you with unsafe methods (like POST or DELETE), which can cause lots of troubles.

latest releases: v11.7.0, v11.6.2, v11.6.1...
6 years ago