#2030 Why plusQuery dont encode params?

Akcelisto Fri 21 Sep 2012

In fansh:

fansh> `uri/a`.plusQuery(["p":"/"])
uri/a?p=/

Expected:

uri/a?p=%3D

brian Fri 21 Sep 2012

The Uri class doesn't model the parts in encoded format - it models them as what we call "standard" form:

fansh>  `a b`.toStr
a b
fansh>  `a b`.encode
a%20b

In your case the "/" isn't a special char in query parts. But consider the ";" which is special (it separates query name/value pairs):

fansh>  `uri/a`.plusQuery(["p":"a;b"])
uri/a?p=a\;b
fansh>  `uri/a`.plusQuery(["p":"a;b"]).encode
uri/a?p=a%3Bb

Notice in standard form we backslash escape it, but percent encode it in the encoded form.

Login or Signup to reply.