From: Arkie Date: Fri, 13 Dec 2019 10:49:15 +0000 (+0800) Subject: Allow explicit Content-Type to take precedence (#633) X-Git-Tag: 0.9.5~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4bb69e3e3e7bafdcefbdd13b6bf5a313594187d2;p=thirdparty%2Fhttpx.git Allow explicit Content-Type to take precedence (#633) --- diff --git a/httpx/models.py b/httpx/models.py index 4f7e78e9..10af37c5 100644 --- a/httpx/models.py +++ b/httpx/models.py @@ -624,7 +624,7 @@ class Request: self.is_streaming = False self.content = content if content_type: - self.headers["Content-Type"] = content_type + self.headers.setdefault("Content-Type", content_type) elif isinstance(data, (str, bytes)): data = data.encode("utf-8") if isinstance(data, str) else data self.is_streaming = False