-
Notifications
You must be signed in to change notification settings - Fork 2
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 trailing slash back in #5
Add trailing slash back in #5
Conversation
Codebase is really old... given the chance, I'd do things differently. I'm in the process of updating node versions, using yarn, and massaging the tests to work with your new scenarios. |
Cool! Let me know if you'd like some extra eyes/hands. It's working great for my use case right now! |
src/capture.js
Outdated
@@ -30,6 +30,12 @@ function listen (appRoot, port, options) { | |||
return !!s; | |||
}).join('/'); | |||
|
|||
// If the final argument ended with a trailing slash, return it. | |||
var last = args.slice(-1)[0]; | |||
if (last.slice(-1) === '/') { |
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.
So the reason for the failing test is related to when the last argument is /
.
Updating the condition to read as below does the trick:
if (last !== '/' && last.slice(-1) === '/') {
path += '/';
}
Do you mind rebasing off master
and applying the suggested change?
Appreciate the contribution by they way. |
24c1e63
to
06e73b4
Compare
I added a couple of test cases drawn to that slash issue. I had to disable one of the FS tests as it was failing on Ubuntu. I also decided to give this awful optimization a shot. Let me know your thoughts. |
Thanks for this. I've fixed up the failing test and published to |
There's a situation where if the server behind the proxy does the following, you can end up in an infinite redirect:
etc.
Rather than try to go too far outside of your design, I altered the
combinePaths
helper to make a quick check to see if there was a trailing slash in the original request, and if so- to add it back.The unit tests seem to be failing on Node 6, so I'm not sure what to do about that. Manual tests pass.