Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions httpie/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,12 @@ def make_request_kwargs(
if base_headers:
headers.update(base_headers)
headers.update(args.headers)
# Ensure Content-Type is set for JSON requests even if user headers
# were provided. This fixes the case where a single custom header
# prevents the default Content-Type from being preserved.
# See: https://github.com/httpie/cli/issues/1834
if auto_json and 'Content-Type' not in headers:
headers['Content-Type'] = JSON_CONTENT_TYPE
Comment on lines +347 to +352
Comment thread
zafar1162014 marked this conversation as resolved.
if args.offline and args.chunked and 'Transfer-Encoding' not in headers:
# When online, we let requests set the header instead to be able more
# easily verify chunking is taking place.
Expand Down
Loading