Easily build bodies and query strings
Closed this issue · 0 comments
visola commented
In HTTPie you can easily pass in key-value pairs and have them be set correctly in your body or query strings. This is a really nice feature that saves a lot of time.
User Story
As a user, when executing a request, I want to be able to easily build a query string or body to add to my request.
Acceptance criteria
Basic functionality is to add this behavior to CLI arguments and also to profiles:
- Internally,
request.Request
now has aValues
field- If method is
GET
and there are key-value pairs, URL encode and add them to the query string - If method is not
GET
- If content-type is not set or is JSON mime type, build a JSON object, ensure content-type and set the JSON in the body
- If content-type is
application/x-www-form-urlencoded
, URL encode values and set them in the body
- If method is
- from the CLI:
- Accept dangling key-value pairs from the CLI and parse them correctly
- from the profiles:
-
requests
now has a new attributevalues
that reads as a map of strings or array of string
-