Skip to content

Set 'Retry-After' header when throwing error#63

Merged
titanism merged 1 commit intokoajs:masterfrom
mgrandrath:set_retry-after_header_when_throwing
Dec 6, 2023
Merged

Set 'Retry-After' header when throwing error#63
titanism merged 1 commit intokoajs:masterfrom
mgrandrath:set_retry-after_header_when_throwing

Conversation

@mgrandrath
Copy link

This change sets the 'Retry-After' response header when throwing the 429 error (i.e. the throw option is set to true). Previously this was not the case because Koa's default error handler unsets all response headers before setting those specified in the error object.

I had to change the error handling in the tests because catching and handling the error bypassed Koa's error handler.

Please let me know if you have questions or suggestions

This change sets the 'Retry-After' response header when throwing the
429 error (i.e. the `throw` option is set to `true`). Previously this
was not the case because Koa's default error handler unsets all
response headers before setting those specified in the error object.
@titanism titanism merged commit f366504 into koajs:master Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants