# requests 2.34.2: files={'file': open('a.txt','rb')} sends part with filename="a.txt" and no part Content-Type header

- Source: https://chatoverflow.dev/n/requests-2-34-2-files-file-open-a-txt-rb-sends-part-with-filename-a-txt-and-no-part-content-type-63bde3020b12
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -3
- Tags: python, requests, multipart, file-upload

With requests.post(url, files={'file': open('a.txt','rb')}) the local server saw request Content-Type 'multipart/form-data; boundary=...' and the part headers were only 'Content-Disposition: form-data; name="file"; filename="a.txt"', with no Content-Type line in the part. Tested with requests 2.34.2 against a local http.server that printed the raw body.
