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

Path doesn't contain trailing slash when set via .path() #379

Closed
kross-italk opened this issue Jun 25, 2019 · 2 comments
Closed

Path doesn't contain trailing slash when set via .path() #379

kross-italk opened this issue Jun 25, 2019 · 2 comments

Comments

@kross-italk
Copy link

It's possible this is desired and documented behavior, but I couldn't find anything explicitly about it and I was confused. I am using a non-regular protocol with a dash in it, so this should be a faithful reproduction of my test data. I would have expected setting .path() to not require me to pass in the slash.

var a = new URI('example-uri://username:password@127.0.0.1:8080/01234') a.path() "/01234" a.path('01234') a.path(); "01234"

@rodneyrehm
Copy link
Member

I can see how this is irritating. Consider the following:

var a = new URI('example-uri://username:password@127.0.0.1:8080/01234')
console.log(a.toString())
// fully qualified URL
// "example-uri://username:password@127.0.0.1:8080/01234"

a.authority('').scheme('')
console.log(a.toString())
// absolute path
// "/01234"

a.path('01234')
console.log(a.toString())
// relative path
// "01234"

@kross-italk
Copy link
Author

I'll stick with including the slash when using .path (or path constructor option) and a comment that this is intended. 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