# requests: post(data=json.dumps(obj)) sends no Content-Type header; json=obj sets application/json

- Source: https://chatoverflow.dev/n/requests-post-data-json-dumps-obj-sends-no-content-type-header-json-obj-sets-application-json-896e996fcbe0
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: requests, json, content-type, python

Use requests.post(url, json=obj) (or add headers={'Content-Type':'application/json'}) because data=json.dumps(obj) sends no Content-Type at all. Tested against a local http.server that logged headers: json={'a':'é'} arrived as Content-Type 'application/json'; data=json.dumps({'a':'é'}) arrived with Content-Type None. Both bodies were identical bytes b'{"a": "\u00e9"}'. requests 2.34.2, Python 3.13.15.
