Skip to content

trustpub: Change PUT /api/v1/trusted_publishing/github_configs endpoint to POST #11390

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/controllers/trustpub/github_configs/create/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ mod tests;

/// Create a new Trusted Publishing configuration for GitHub Actions.
#[utoipa::path(
put,
post,
path = "/api/v1/trusted_publishing/github_configs",
security(("cookie" = [])),
request_body = inline(json::CreateRequest),
Expand Down
16 changes: 8 additions & 8 deletions src/controllers/trustpub/github_configs/create/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async fn run_test(payload: impl Into<Bytes>) -> (TestApp, Response<()>) {
.await
.unwrap();

(app, cookie_client.put::<()>(URL, payload).await)
(app, cookie_client.post::<()>(URL, payload).await)
}

inner(payload.into()).await
Expand Down Expand Up @@ -213,7 +213,7 @@ async fn test_unauthenticated() -> anyhow::Result<()> {
}
}))?;

let response = client.put::<()>(URL, body).await;
let response = client.post::<()>(URL, body).await;
assert_snapshot!(response.status(), @"403 Forbidden");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"this action requires authentication"}]}"#);

Expand Down Expand Up @@ -243,7 +243,7 @@ async fn test_token_auth() -> anyhow::Result<()> {
}
}))?;

let response = token_client.put::<()>(URL, body).await;
let response = token_client.post::<()>(URL, body).await;
assert_snapshot!(response.status(), @"403 Forbidden");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"this action can only be performed on the crates.io website"}]}"#);

Expand All @@ -267,7 +267,7 @@ async fn test_missing_crate() -> anyhow::Result<()> {
}
}))?;

let response = cookie_client.put::<()>(URL, body).await;
let response = cookie_client.post::<()>(URL, body).await;
assert_snapshot!(response.status(), @"404 Not Found");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crate `foo` does not exist"}]}"#);

Expand Down Expand Up @@ -299,7 +299,7 @@ async fn test_non_owner() -> anyhow::Result<()> {
}
}))?;

let response = other_client.put::<()>(URL, body).await;
let response = other_client.post::<()>(URL, body).await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"You are not an owner of this crate"}]}"#);

Expand Down Expand Up @@ -331,7 +331,7 @@ async fn test_unknown_github_user() -> anyhow::Result<()> {
}
}))?;

let response = cookie_client.put::<()>(URL, body).await;
let response = cookie_client.post::<()>(URL, body).await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"Unknown GitHub user or organization"}]}"#);

Expand Down Expand Up @@ -363,7 +363,7 @@ async fn test_github_error() -> anyhow::Result<()> {
}
}))?;

let response = cookie_client.put::<()>(URL, body).await;
let response = cookie_client.post::<()>(URL, body).await;
assert_snapshot!(response.status(), @"500 Internal Server Error");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"Internal Server Error"}]}"#);

Expand Down Expand Up @@ -398,7 +398,7 @@ async fn test_unverified_email() -> anyhow::Result<()> {
}
}))?;

let response = cookie_client.put::<()>(URL, body).await;
let response = cookie_client.post::<()>(URL, body).await;
assert_snapshot!(response.status(), @"403 Forbidden");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"You must verify your email address to create a Trusted Publishing config"}]}"#);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4227,7 +4227,7 @@ expression: response.json()
"trusted_publishing"
]
},
"put": {
"post": {
"operationId": "create_trustpub_github_config",
"requestBody": {
"content": {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/krate/publish/trustpub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ async fn test_full_flow() -> anyhow::Result<()> {
}))?;

let url = "/api/v1/trusted_publishing/github_configs";
let response = cookie_client.put::<()>(url, body).await;
let response = cookie_client.post::<()>(url, body).await;

assert_json_snapshot!(response.json(), { ".github_config.created_at" => "[datetime]" }, @r#"
{
Expand Down