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

Redirects? #42

Closed
coughlanio opened this issue May 19, 2021 · 2 comments
Closed

Redirects? #42

coughlanio opened this issue May 19, 2021 · 2 comments

Comments

@coughlanio
Copy link

Hi,

Is there a way to handle redirects/301/302?

Thanks,
Chris

@markusahlstrand
Copy link
Owner

You can do it manually by setting the location header of the response, but we should really support it the same way koa does it with ctx.redirect(). I'll see if I can add that to the next release

@coughlanio
Copy link
Author

coughlanio commented May 19, 2021

Perfect!

ctx.response.headers["location"] = url;
ctx.status = 301;

Thanks!

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

No branches or pull requests

2 participants