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

Utility to get url without host (path + query + [hash]) #211

Closed
1 task done
IgnisDa opened this issue Feb 24, 2024 · 5 comments · Fixed by #212
Closed
1 task done

Utility to get url without host (path + query + [hash]) #211

IgnisDa opened this issue Feb 24, 2024 · 5 comments · Fixed by #212

Comments

@IgnisDa
Copy link
Contributor

IgnisDa commented Feb 24, 2024

Describe the feature

Would it be possible to add a utility which does the following:

withoutHost("http://localhost:8000/media/search/movie?query=drive")
// `/media/search/movie?query=drive`

This would effectively be:

const url = new URL(input)
return url.pathname + url.search

Additional information

  • Would you be willing to help implement this feature?
@pi0 pi0 changed the title Get URL without the host Utility to get url without host (path + query + [hash]) Feb 24, 2024
@pi0
Copy link
Member

pi0 commented Feb 24, 2024

This is a good idea. PR welcome 👍🏼

@IgnisDa
Copy link
Contributor Author

IgnisDa commented Feb 24, 2024

Should this be done after #208?

@pi0
Copy link
Member

pi0 commented Feb 24, 2024

we can do it before

@IgnisDa
Copy link
Contributor Author

IgnisDa commented Feb 25, 2024

@pi0 what should I name the utility function?

@pi0
Copy link
Member

pi0 commented Feb 25, 2024

I think withoutHost is best so far I was thinking about getFullPath, but it can be confusing.

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

Successfully merging a pull request may close this issue.

2 participants