Skip to content

Commit

Permalink
chore(models): use preferred notation for JSON content-type (#204)
Browse files Browse the repository at this point in the history
I noticed that the content-type looked like this:
`"Content-Type": "application/json; charset=\"utf-8\"",`

and then I checked the corresponding RFC (7231) to see if that's valid.
It is valid, but not the preferred way.


![image](https://github.com/user-attachments/assets/c55b1fc8-4140-4cf2-8595-7a6098c3fda1)


---

Update: [reference to
RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-media-type)
  • Loading branch information
Zerotask authored Jan 22, 2025
1 parent 51d3fb7 commit d06129d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/niquests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ def prepare_body(
if not data and json is not None:
# urllib3 requires a bytes-like body. Python 2's json.dumps
# provides this natively, but Python 3 gives a Unicode string.
content_type = 'application/json; charset="utf-8"'
content_type = "application/json;charset=utf-8"
json_kwargs = {}

if not hasattr(_json, "orjson"):
Expand Down

0 comments on commit d06129d

Please sign in to comment.