Discussion:
Preserving parameters ordering in url.Values
s***@public.gmane.org
2014-06-19 15:35:22 UTC
Permalink
Hi Guys,

if i have url.Values, on which i add a couple of parameters, eg.

c=1
b=2
a=3

is it possible that encoded link will be
&c=1&b=2&a=3

instead of
&a=3&b=2&c=1

Basically i want to have parameters added first encoded as first... but it
seems there's no way to get rid of sorting that is done before encoding...

Thanks.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Brian Hatfield
2014-06-19 15:43:48 UTC
Permalink
What are you trying to do?

Go's HTTP Request object allows you to retrieve form values by name,
without needing to manually break up the URL yourself:

http://golang.org/pkg/net/http/#Request.FormValue

Is that helpful for your goal?
Post by s***@public.gmane.org
Hi Guys,
if i have url.Values, on which i add a couple of parameters, eg.
c=1
b=2
a=3
is it possible that encoded link will be
&c=1&b=2&a=3
instead of
&a=3&b=2&c=1
Basically i want to have parameters added first encoded as first... but it
seems there's no way to get rid of sorting that is done before encoding...
Thanks.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
s***@public.gmane.org
2014-06-20 06:49:44 UTC
Permalink
Hi Brian,
im trying to generate "user friendly" URLs, as some parameters in URLs im
generating are important and some not, i want to bring the important ones
into the front of the string. Eg. im passing referer in URL if i put it
into the front, it becomes very hard to modify it by user, because it'll
require some practise to see where referer ends and other parameters start.

For retrieving actually url.Values can be userd in FOR ... RANGE loop, as
Andrew pointed out probably i'll need custom encoder written

Thanks

W dniu czwartek, 19 czerwca 2014 17:44:46 UTC+2 uÅŒytkownik Brian Hatfield
Post by Brian Hatfield
What are you trying to do?
Go's HTTP Request object allows you to retrieve form values by name,
http://golang.org/pkg/net/http/#Request.FormValue
Is that helpful for your goal?
Post by s***@public.gmane.org
Hi Guys,
if i have url.Values, on which i add a couple of parameters, eg.
c=1
b=2
a=3
is it possible that encoded link will be
&c=1&b=2&a=3
instead of
&a=3&b=2&c=1
Basically i want to have parameters added first encoded as first... but
it seems there's no way to get rid of sorting that is done before
encoding...
Thanks.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
a***@public.gmane.org
2014-06-19 21:27:04 UTC
Permalink
They seem to be stored in a map by the code which is unordered. Not sure if
its possible without writing your own query parser.
Post by s***@public.gmane.org
Hi Guys,
if i have url.Values, on which i add a couple of parameters, eg.
c=1
b=2
a=3
is it possible that encoded link will be
&c=1&b=2&a=3
instead of
&a=3&b=2&c=1
Basically i want to have parameters added first encoded as first... but it
seems there's no way to get rid of sorting that is done before encoding...
Thanks.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Loading...