Parsing query strings with keys of the same name
The browser behavior (and standard if I can dig up the forms spec) of HTML forms with array-like values is to include a query string with repeated keys.
This multi-select:
<select name="colors" multiple>
<option value="orange">orange</option>
<option value="purple">purple</option>
</select>
Will result in ?colors=orange&colors=purple if both options are selected. Instead of parsing this as a list, parseQuery ignores the second value. Furthermore, the query is represented as a lookup map of bytestrings, so has no notion of multiple values per key.
The reason I bring this issue up is this use case: basic HTML form with a multi-select and no JS and a haskell backend using http-types. The http-types Query type and parsers fail that use case.
Fair point. How about this? We leave Query and QueryItem as is, but make a generic Query-like type that allows putting in Maybe or [], and we just use a generic "append" operation that either replaces or adds an element.
I would most welcome pull requests for this! :-)
To clarify: The parseQuery function would always work in terms of the generic type.
I'm pretty sure parseQuery just creates a list of key-value pairs. (at least currently)