GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||
GeezerVison is showing github.com — fix: Explicitly set boundary for multipart/form-data by linkdd · Pull Request #1005 · openapi-generators/openapi-python-client Conversation
Contributor
Actual BehaviorWhen an endpoint only has one body type, which is However, when an endpoint has multiple body types, the Proposed ChangesLet's always set the boundary to NB: This is kind of related to #1004, since in my specific case, the
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
dbanty
force-pushed
the
multipart-boundary
branch
from
e48dfc7 to
9c3f8b1
Compare
dbanty
force-pushed
the
multipart-boundary
branch
from
9c3f8b1 to
cb36cbd
Compare
dbanty
approved these changes
Merged
via the queue into
openapi-generators:main
with commit
fb3f866
41 of 43 checks passed
Uh oh!
There was an error while loading. Please reload this page.
Merged
iloveitaly
pushed a commit
to iloveitaly/openapi-python-client
that referenced
this pull request
> [!IMPORTANT] > Merging this pull request will create this release ## Breaking Changes - Drop support for Python 3.10 - Raise minimum httpx version to 0.23.1 ## Features - replace python-dateutil with stdlib datetime.fromisoformat (openapi-generators#1429) ## Fixes - Remove some generated casts that aren't necessary with mypy v2 (openapi-generators#1436) - Explicitly set boundary for multipart/form-data (openapi-generators#1005) Co-authored-by: knope-bot[bot] <152252888+knope-bot[bot]@users.noreply.github.com>
sda-mikerochefort
pushed a commit
to sda-mikerochefort/openapi-python-client
that referenced
this pull request
…rators#1511) Fixes openapi-generators#1509 Since openapi-generators#1005 every generated `multipart/form-data` request sets `Content-Type: multipart/form-data; boundary=+++`. httpx2 builds the body with that boundary, so a file that contains `\r\n--+++` is split there and the server gets a truncated file plus a stray part. This stops setting `Content-Type` for `multipart/form-data` bodies. httpx2 then adds the header with its own random boundary, the same way single-body endpoints worked before 0.29.0. For endpoints with several body types, the multipart branch no longer sets the header either, so openapi-generators#947 stays fixed: httpx2 still writes a boundary because the header isn't set. The other content types still set their header explicitly. Changes: - `endpoint_module.py.jinja`: skip the `Content-Type` line for multipart bodies. - Golden records and the integration-test client regenerated (only the `boundary=+++` line goes away). - New functional test `test_multipart_bodies.py`: generates a single-body and a multi-body endpoint, sends a file containing `\r\n--+++` through a `MockTransport` and parses the multipart body back. - Patch changeset. Testing: - `pytest end_to_end_tests/functional_tests/generated_code_execution/test_multipart_bodies.py` - before the template change: 2 failed (`{'file': b'first line'} != {'file': b'first line\r\n--+++\r\nstill the same file\r\n'}`), 1 passed (JSON control) - after: 3 passed - Full `pdm test` equivalent with coverage: 471 passed, 100% coverage, 5 snapshots passed - `ruff format --check .`, `ruff check .`, `mypy openapi_python_client fuzz` pass I didn't run the `integration` job locally because it needs the openapi-test-server container.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. | ||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |