got starting from version 15 started dropping request body when followRedirect: true
The comment is wrong in the source code
|
// 301/302 POST already drops the body (converted to GET above). |
|
// 307/308 preserve the method per RFC, but the body must not be |
and the shouldDropBody flag
|
this._stripCrossOriginState(updatedOptions, redirectUrl, shouldDropBody); |
should be false when http status code is 307 or 308
https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/307
https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/308
all other major http clients (including ky) I have tested retains the body on POST method when encountering 308 redirect.
gotstarting from version 15 started dropping request body when followRedirect: trueThe comment is wrong in the source code
got/source/core/index.ts
Lines 1088 to 1089 in e5e645a
and the shouldDropBody flag
got/source/core/index.ts
Line 1093 in e5e645a
should be false when http status code is 307 or 308
https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/307
https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/308
all other major http clients (including
ky) I have tested retains the body on POST method when encountering 308 redirect.