Explicitly set boundary for multipart/form-data #1005
Knope Bot / Require changes to be documented
required action
May 18, 2024 in 0s
This pull request has not been documented yet
This project requires changes to be documented via either changesets or conventional commits. Depending on how this pull request is merged, it may not be fully documented:
- ❌ Squash merging is allowed, but the title is not a conventional commit
- ✅ Merge commits are disabled
- ✅ Rebase merging is disabled
You can either correct the above issues, or use a change file to document this pull request. knope-bot can't auto-generate a change file for this pull request. Instead, you can document the change manually by creating a change file with Knope or following these instructions:
- Create a file named
.changeset/explicitly_set_boundary_for_multipartform_data.md
- Copy and paste the below Markdown into the file
- Replace "CHANGE_TYPE" with
major
,minor
, orpatch
(see knope's docs for what those mean) - Edit the content as needed to be applicable to users of the project (not maintainers)
Details
---
default: CHANGE_TYPE
---
# Explicitly set boundary for multipart/form-data
#1005 by @linkdd
| Python Version | OpenAPI Client Generator Version |
| --- | --- |
| 3.11.6 | 0.18.0 |
## Actual Behavior
When an endpoint only has one body type, which is `multipart/form-data`, the `Content-Type` header is not set, so that HTTPX can set it with the correct boundary.
However, when an endpoint has multiple body types, the `Content-Type` header is always set, and HTTPX do not override it, which results in a missing boundary for `multipart/form-data` body types (resulting in a `400 - Bad Request` response from the servers).
## Proposed Changes
Let's always set the boundary to `+++` to avoid any potential problem.
**NB:** This is kind of related to #1004, since in my specific case, the `multipart/form-data` body type is the last, it is always the one that is used.
Loading