We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When POSTing to an URL with an unsupported protocol, the beforeError hook is not called.
beforeError
The beforeError hook should be called just like with other errors, e.g. ERR_NON_2XX_3XX_RESPONSE.
ERR_NON_2XX_3XX_RESPONSE
import got from "got"; const redactAuthorizationHeader = (error) => { error.options.headers.authorization = "<redacted>"; error.options._init[0].headers.authorization = "<redacted>"; return error; }; const post = (payload) => got .post(`xhttps://www.example.com/some/resource`, { headers: { authorization: `Bearer secret` }, json: payload, hooks: { beforeError: [redactAuthorizationHeader] }, }) .json(); await post({ foo: 42 });
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
Actual behavior
When POSTing to an URL with an unsupported protocol, the
beforeError
hook is not called.Expected behavior
The
beforeError
hook should be called just like with other errors, e.g.ERR_NON_2XX_3XX_RESPONSE
.Code to reproduce
Checklist
The text was updated successfully, but these errors were encountered: