You've already forked httpie-cli
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:
@@ -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)):
|
||||
|
Reference in New Issue
Block a user