Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly set boundary for multipart/form-data #1005

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

linkdd
Copy link

@linkdd linkdd commented Mar 15, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants