got
got copied to clipboard
Bug: POST request with `followRedirect` set to `false` does not throw an error on `302` status code response
Describe the bug
- Node.js version: v16.18.1
- OS & version: macOS
According to the docs, if you set followRedirect: false
, then a 302
status code should throw an error of ERR_NON_2XX_3XX_RESPONSE
as per https://github.com/sindresorhus/got/blob/c41a98a6f76fa265476abdccb1a823651dbe961b/documentation/8-errors.md#httperror. There is no way to configure the limitStatusCode
variable used here https://github.com/sindresorhus/got/blob/3e82b500bc1bcf40ec5b56d295142f5a941f6a6e/source/core/response.ts#L118-L120.
Actual behavior
If followRedirect: false
then 302 status code does not throw error.
Expected behavior
If followRedirect: false
then 302 status code should throw error.
Checklist
- [x] I have read the documentation.
- [x] I have tried my code with the latest version of Node.js and Got.