openapi-python-client icon indicating copy to clipboard operation
openapi-python-client copied to clipboard

Explicitly set boundary for multipart/form-data

Open linkdd opened this issue 1 year ago • 0 comments

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.

linkdd avatar Mar 15 '24 14:03 linkdd