mirror of https://github.com/asciimoo/wuzz
Add support for `--data-urlencode`, and for multiple data options
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.pull/94/head
parent
c8a6ff4569
commit
3ad407e0a1
Loading…
Reference in New Issue