-
Notifications
You must be signed in to change notification settings - Fork 87
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
Add option directorySlash to redirect with slash #125
Conversation
@@ -108,6 +109,10 @@ async function send (ctx, path, opts = {}) { | |||
// and not require a trailing slash for directories, | |||
// so that you can do both `/directory` and `/directory/` | |||
if (stats.isDirectory()) { | |||
if (directorySlash && !trailingSlash) { | |||
ctx.redirect(ctx.request.path + '/') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍, can you write the test !!
ctx.redirect(ctx.request.path + '/') | |
ctx.redirect(`${ctx.request.path}/`) |
I don't know about this - I think just using |
Hi @niftylettuce Would you please reconsider this feature? When accessing
...and
I feel it reasonable to expect a built-in redirection since that is other static servers do. Monkey patching works, but is annoying. |
For anyone who is interested, The library that adds a trailing slash is |
@liqi0816 can you just add a PR to |
I can, but may I know if there is a reason |
Just verified I understand |
Aims to implement support for #81.