File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -283,8 +283,12 @@ For example, the GitHub API v3 accepts JSON-Encoded POST/PATCH data::
283
283
284
284
>>> r = requests.post(url, data=json.dumps(payload))
285
285
286
- Instead of encoding the ``dict `` yourself, you can also pass it directly using
287
- the ``json `` parameter (added in version 2.4.2) and it will be encoded automatically::
286
+ Please note that the above code will NOT add the ``Content-Type `` header
287
+ (so in particular it will NOT set it to ``application/json ``).
288
+
289
+ If you need that header set and you don't want to encode the ``dict `` yourself,
290
+ you can also pass it directly using the ``json `` parameter (added in version 2.4.2)
291
+ and it will be encoded automatically:
288
292
289
293
>>> url = ' https://api.github.com/some/endpoint'
290
294
>>> payload = {' some' : ' data' }
@@ -293,8 +297,6 @@ the ``json`` parameter (added in version 2.4.2) and it will be encoded automatic
293
297
294
298
Note, the ``json `` parameter is ignored if either ``data `` or ``files `` is passed.
295
299
296
- Using the ``json `` parameter in the request will change the ``Content-Type `` in the header to ``application/json ``.
297
-
298
300
POST a Multipart-Encoded File
299
301
-----------------------------
300
302
You can’t perform that action at this time.
0 commit comments