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

URL.href adds a trailing slash at end, but browsers don't #45216

Closed
markcellus opened this issue Oct 27, 2022 · 1 comment
Closed

URL.href adds a trailing slash at end, but browsers don't #45216

markcellus opened this issue Oct 27, 2022 · 1 comment

Comments

@markcellus
Copy link

Version

v16.15.1

Platform

Linux [redacted] 5.15.0-52-generic #58-Ubuntu SMP Thu Oct 13 08:03:55 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

In node do the following

new URL(`https://abc.xyz`).href

How often does it reproduce? Is there a required condition?

N/A

What is the expected behavior?

'https://abc.com'

What do you see instead?

'https://abc.com/'

Additional information

I'm assuming the the URL module in Node is meant to be interoperable with the DOM W3C URL specification. Since doing this command in a browser doesn't produce a trailing slash, it appears to be a bug for Node to add one.

@markcellus
Copy link
Author

Hmm it appears that the Location.href in the browser returns it without the trailing slash. So I was mistaken thinking Location is synonymous with URL. Closing.

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

1 participant