Skip to content
New issue

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

feat(middleware): support overwriting response after next() #970

Merged
merged 1 commit into from
Mar 13, 2023

Conversation

yusukebe
Copy link
Member

This PR enables completely overwriting the response from middleware after next(). This matter is mentioned at #960 .

We can do it by putting undefined:

app.use('*', async (c, next) => {
  await next()
  c.res = undefined
  c.res = new Response('New Response')
})

Good PR, as this is done with very few codes.

Fix #960

@yusukebe yusukebe merged commit b5cd193 into next Mar 13, 2023
@yusukebe yusukebe deleted the feat/overwrite-response-after-next branch March 13, 2023 13:01
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.

1 participant