NET-A-PORTER/scala-uri

Allow serializing empty keys to "key=" rather than "key"

Closed this issue · 1 comments

In 0.4.3:

val uri_string = "https://a.domain.here?a=1&b=&c="
uri_string ? ("d", "")

results in:

res3: com.netaporter.uri.Uri = https://a.domain.here?a=1&b&c&d

Ideally, it would be possible to specify that the desired serialization is:

res3: com.netaporter.uri.Uri = https://a.domain.here?a=1&b=&c=&d=

Nothing is specified about this in RFC 3986, but the HTML5 form section regarding application/x-www-form-urlencoded encoding has this to say about the encoding steps:

  1. If this is not the first entry, append a single U+0026 AMPERSAND character (&) to result.
  2. Append the entry's name to result.
  3. Append a single "=" (U+003D) character to result.
  4. Append the entry's value to result.

This change was introduced in 9e20420 (more specifically, this change to Parameters.scala)

Should be fixed by #76