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

Support Relative URLs #13

Open
xoich opened this issue Nov 3, 2024 · 1 comment
Open

Support Relative URLs #13

xoich opened this issue Nov 3, 2024 · 1 comment
Labels
help wanted Contributions encouraged

Comments

@xoich
Copy link

xoich commented Nov 3, 2024

the JS API supports URLs like /path but also path or ../path. It's not possible to do with this library because Request forces you to have scheme and host.

You can set up a request with host set as the empty string but that doesn't work because the conversion of the request to string url results in https:///path which is an invalid URL. If the conversion resulted in https:/path it would have been better, as this is valid, but it's still not great forcing you to detect the scheme.

It's true that you can workaround this using FFI or an external library to get location and path, but it's a bit cumbersome, especially when relative paths like ../path come into play, then you also have to write code to manipulate the path.

Maybe this issue brings to light an underlying problem with the Request type or its conversion to Uri and then to string, but if so, I wouldn't know how could these be fixed in a backward compatible way.

@lpil
Copy link
Member

lpil commented Nov 4, 2024

Sounds good!

@lpil lpil added the help wanted Contributions encouraged label Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Contributions encouraged
Projects
None yet
Development

No branches or pull requests

2 participants