-
Notifications
You must be signed in to change notification settings - Fork 2.9k
cargo publish does not send Content-Type header #16830
Copy link
Copy link
Closed
Labels
A-documenting-cargo-itselfArea: Cargo's documentationArea: Cargo's documentationA-interacts-with-crates.ioArea: interaction with registriesArea: interaction with registriesC-bugCategory: bugCategory: bugCommand-publishS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewStatus: Issue or feature is accepted, and has a team member available to help mentor or review
Metadata
Metadata
Assignees
Labels
A-documenting-cargo-itselfArea: Cargo's documentationArea: Cargo's documentationA-interacts-with-crates.ioArea: interaction with registriesArea: interaction with registriesC-bugCategory: bugCategory: bugCommand-publishS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewStatus: Issue or feature is accepted, and has a team member available to help mentor or review
Type
Fields
Give feedbackNo fields configured for issues without a type.
Problem
Context: I am writing a new 3rd party registry implementation (https://github.com/pulp/pulp_rust)
I noticed that
cargo publishdoes not send theContent-Typeheader. Per RFC 7231, senders SHOULD include Content-Type when a body is present. The omission causes problems with web frameworks like Django REST Framework (which I am using) that select a body parser based on Content-Type and fall back to a JSON parser when the header is absent, which of course doesn't work because the body is actually a binary payload.Steps
cargo publishrequest against an MITM or alternate registry implementation which logs incoming request metadataContent-TypeheaderPossible Solution(s)
Add
headers.append("Content-Type: application/octet-stream")?;to hereNotes
No response
Version