Multiple get parameters with the same name are now printed each in their
own line. The parameters get added to the query string correctly, each
one as a single param.
This commit attempts to bring greater consistency between
cURL, and wuzz use of body data.
Previously, when `--data` was used more than once, only the last
use of it would be added to the request body. cURL however, allows
multiple 'data' options to be specified, and it will simply
merge them using the `&` symbol separator.
Furthermore, this commit removes the default query unescaping for
body data so that `--data-urlencode` can be supported. This is to
emulate the behaviour in cURL where `--data-urlencode` will use
percent encoding on the given data. If the default query unescaping
was not removed, we will always show, and send unescaped data.
Example:
wuzz -k curl -X POST http://kong:8001/apis/123-456-789/plugins \
--data "name=key-auth" \
--data "config.hide_credentials=true"
In the future, `@` support should be added for data. That is, it
should be able to load a file to include as part of the payload.
Also, for percent encoding to work, this commit takes the argument
data, and constructs a Go `url.URL` struct. It then converts that
URL into a string to take advantage of its internal logic for encoding
spaces. Once `wuzz` is upgraded to build using Go 1.8, we can then
use `PathEscape` instead to achieve this.
See: https://github.com/golang/go/issues/7682
Custom headers are set using `headers.Set(..)`.
When it comes to the `Host` header however, this will have no impact
because the request uses the `Host` field from `Request`. If it is
not set, then `URL.Host` will be used.
This commit will make `wuzz` behaviour consistent with cURL.
In addition, detection of JSON bodies has been expanded to include
both "application/json" as well as any Content-Type ending in "+json".
This should catch all JSON media types as registered in the IANA Media
Type registry located here:
http://www.iana.org/assignments/media-types/media-types.xhtml