Skip to content

3.0.0

Compare
Choose a tag to compare
@floatdrop floatdrop released this 06 May 06:38
· 1358 commits to main since this release

Changes

52490b2 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.

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

Breaking changes

2302a1e 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.

v2.9.0...v3.0.0