From b72e4ecc3e564d3dcd03205b4998098dea5e2df0 Mon Sep 17 00:00:00 2001 From: ChampChamp Date: Fri, 10 Apr 2026 22:29:02 +0900 Subject: [PATCH] Fix #1665: Handle long strings with spaces from CLI --- httpie/uploads.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/httpie/uploads.py b/httpie/uploads.py index 4a993b3a25..42a736b9f6 100644 --- a/httpie/uploads.py +++ b/httpie/uploads.py @@ -267,3 +267,8 @@ def compress_request( request.body = deflated_data request.headers['Content-Encoding'] = 'deflate' request.headers['Content-Length'] = str(len(deflated_data)) + content_type = request.headers.get('Content-Type') or b'' + if isinstance(content_type, str): + content_type = content_type.encode() + if b'application/x-www-form-urlencoded' in content_type: + request.headers['Content-Type'] = b'multipart/form-data; boundary=httpie'