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

net/url: url.Query() is not returning the correct value #59821

Closed
aayush-sib opened this issue Apr 25, 2023 · 2 comments
Closed

net/url: url.Query() is not returning the correct value #59821

aayush-sib opened this issue Apr 25, 2023 · 2 comments

Comments

@aayush-sib
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.19.6 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

What did you do?

Code -> https://go.dev/play/p/pLLAs_g3v1l

What did you expect to see?

map[query1:[test]]

What did you see instead?

map[]

@CADawg
Copy link

CADawg commented Apr 25, 2023

This looks to be correct behaviour, javascript agrees:
image

I think this is as it comes after the #, which is considered the anchor, which always has to come after the query string, and since it sees the # it considers that the anchor rather than the query string as you'd expect

image
Source

i.e. the Anchor for this URL is /1?query1=test. It would have to come before the # in order to be parsed as the query string.

Hope this helps :)

@aayush-sib
Copy link
Author

Thanks a lot @Snaddyvitch-Dispenser
I was confused with # it's clear now.

Closing this issue

@golang golang locked and limited conversation to collaborators Apr 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants