Skip to content

Fix bodyless request content length - #45

Merged
lightsofapollo merged 1 commit into
mainfrom
agent/content-length-zero
Jul 28, 2026
Merged

Fix bodyless request content length#45
lightsofapollo merged 1 commit into
mainfrom
agent/content-length-zero

Conversation

@lightsofapollo

Copy link
Copy Markdown
Contributor

Summary

  • emit an explicit Content-Length: 0 header for bodyless POST, PUT, and PATCH operations
  • cover operations with no request body, schema-less request bodies, and optional bodies passed as None
  • leave GET, HEAD, DELETE, OPTIONS, and TRACE behavior unchanged

Root cause

Bodyless generated requests did not provide an explicit content length. Some gateways, including Google Front End, reject those requests with 411 Length Required. An explicit empty Reqwest body is not sufficient on the current Reqwest/Hyper stack because an already-ended empty body can still be sent without a Content-Length header.

Impact

Generated Rust method signatures and model APIs are unchanged. This only changes HTTP wire framing for bodyless POST, PUT, and PATCH requests.

Validation

  • cargo fmt --all -- --check
  • cargo clippy --all-features -- -D warnings
  • cargo test --all-features

Fixes #43

@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openapi-to-rust Ready Ready Preview, Comment Jul 28, 2026 8:47pm

Request Review

@lightsofapollo
lightsofapollo marked this pull request as ready for review July 28, 2026 20:58
@lightsofapollo
lightsofapollo merged commit d057899 into main Jul 28, 2026
12 checks passed
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.

[feature]: Generate empty bodies for bodyless POST and PUT requests

1 participant