From e30c081d5ae15bbee0131e9fc2309d4c70da0baa Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Sat, 7 Mar 2026 21:03:05 +0800 Subject: [PATCH] Send mint-token requests with a proper Content-Type (#18334) ## Summary Using `.body()` meant that the request was sent without a `Content-Type`, whereas we want to explicitly communicate that the mint-token request is a JSON payload. Using `.json()` causes request to send the `Content-Type` header by default. ## Test Plan Existing coverage. --------- Signed-off-by: William Woodruff --- crates/uv-publish/Cargo.toml | 2 +- crates/uv-publish/src/trusted_publishing/pypi.rs | 2 +- crates/uv-publish/src/trusted_publishing/pyx.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/uv-publish/Cargo.toml b/crates/uv-publish/Cargo.toml index d02d8a591..b0298645c 100644 --- a/crates/uv-publish/Cargo.toml +++ b/crates/uv-publish/Cargo.toml @@ -36,7 +36,7 @@ futures = { workspace = true } glob = { workspace = true } itertools = { workspace = true } reqwest = { workspace = true } -reqwest-middleware = { workspace = true } +reqwest-middleware = { workspace = true, features = ["json"] } reqwest-retry = { workspace = true } rustc-hash = { workspace = true } serde = { workspace = true, features = ["derive"] } diff --git a/crates/uv-publish/src/trusted_publishing/pypi.rs b/crates/uv-publish/src/trusted_publishing/pypi.rs index 54d3e6d73..5d1644211 100644 --- a/crates/uv-publish/src/trusted_publishing/pypi.rs +++ b/crates/uv-publish/src/trusted_publishing/pypi.rs @@ -83,7 +83,7 @@ impl TrustedPublishingService for PyPIPublishingService<'_> { let response = self .client .post(Url::from(mint_token_url.clone())) - .body(serde_json::to_vec(&mint_token_payload)?) + .json(&mint_token_payload) .send() .await .map_err(|err| { diff --git a/crates/uv-publish/src/trusted_publishing/pyx.rs b/crates/uv-publish/src/trusted_publishing/pyx.rs index 60fdba92c..5670272ef 100644 --- a/crates/uv-publish/src/trusted_publishing/pyx.rs +++ b/crates/uv-publish/src/trusted_publishing/pyx.rs @@ -109,7 +109,7 @@ impl TrustedPublishingService for PyxPublishingService<'_> { let response = self .client .post(Url::from(mint_token_url.clone())) - .body(serde_json::to_vec(&mint_token_payload)?) + .json(&mint_token_payload) .send() .await .map_err(|err| {