POST Multipart-Encoding does not work if the Content-Type header has been previously defined in the session
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 54.3k
- Forks
- 10.4k
- Avg merge
- 16h 43m
- Merged PRs (30d)
- 3
Description
Hi,
I just wasted two hours because it seems that the POST Multiple Multipart-Encoded Files function does not work if a Content-Type has been previously defined at the session level.
Example:
...
session.headers.update({“Content-Type”: “application/json”})
...
response = session.post(
“http://localhost:3000/api/v1/pipelines/upload”,
files={
“file”: (“hello_world3.py”, f, “text/x-python”)
},
data={
“urlIdx”: “2”
}
)
Two suggestions:
a.Either modify the implementation of POST Multiple Multipart-Encoded Files to overwrite the content of theContent-Typeheader even if it has been defined at the session levelb.Or issue a warning message to inform the developer of their possible error
What do you think?
Best regards,
Stéphane
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the example from the “POST Multiple Multipart-Encoded Files” documentation section, including a session-level Content-Type header, then trace how the session.post call prepares the multipart request. Determine the expected behavior for the conflicting header and verify it with a focused regression test or warning check; done means the behavior is documented and consistently tested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100