/jsonquery

HTTP query strings written as JSON arrays

Primary LanguageGo

jsonquery

Build Status GoDoc

Hacked together to get around the AWS API Gateway issue documented here (Duplicated query string parameters are not supported).

All queries for a given prefix are expected to be a JSON array of strings. These are unmarshalled as individual strings, so they are accessible via url.Query().

For example, a url.URL of:

https://example.com?json_foo=["a","b","c"]

Becomes available from the url.URL:

HandleURL(url, "foo_")
foos := url.Query()["foo"]
fmt.Printf("%#v", foos) // []string{"a", "b", "c"}

You'll probably want to put this in http.Handler middleware.