1
0
mirror of https://github.com/httpie/cli.git synced 2025-08-10 22:42:05 +02:00

-j/--json now adds "Accept": "application/json" to GET requests if no previous Accept header exists.

This commit is contained in:
Jake Basile
2012-04-14 14:13:53 -05:00
parent 4da3821bc4
commit 45ce446017
2 changed files with 6 additions and 0 deletions

View File

@@ -124,6 +124,8 @@ def main(args=None,
# JSON/Form content type.
if args.json or (not args.form and data):
if args.method.lower() == 'get' and 'Accept' not in headers:
headers['Accept'] = 'application/json'
if stdin_isatty:
data = json.dumps(data)
if not files and ('Content-Type' not in headers and (data or args.json)):