diff --git a/Cargo.lock b/Cargo.lock index 2088db67608..f770f2e87cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -493,14 +493,14 @@ dependencies = [ [[package]] name = "axum" -version = "0.7.9" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" +checksum = "6d6fd624c75e18b3b4c6b9caf42b1afe24437daaee904069137d8bab077be8b8" dependencies = [ - "async-trait", "axum-core", "axum-macros", "bytes", + "form_urlencoded", "futures-util", "http 1.2.0", "http-body 1.0.1", @@ -528,11 +528,10 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.4.5" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" +checksum = "df1362f362fd16024ae199c1970ce98f9661bf5ef94b9808fee734bc3698b733" dependencies = [ - "async-trait", "bytes", "futures-util", "http 1.2.0", @@ -549,26 +548,26 @@ dependencies = [ [[package]] name = "axum-extra" -version = "0.9.6" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c794b30c904f0a1c2fb7740f7df7f7972dfaa14ef6f57cb6178dc63e5dca2f04" +checksum = "460fc6f625a1f7705c6cf62d0d070794e94668988b1c38111baeec177c715f7b" dependencies = [ "axum", "axum-core", "bytes", "cookie", - "fastrand", + "form_urlencoded", "futures-util", "headers", "http 1.2.0", "http-body 1.0.1", "http-body-util", "mime", - "multer", "pin-project-lite", "serde", "serde_html_form", "serde_json", + "serde_path_to_error", "tower", "tower-layer", "tower-service", @@ -577,9 +576,9 @@ dependencies = [ [[package]] name = "axum-macros" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d123550fa8d071b7255cb0cc04dc302baa6c8c4a79f55701552684d8399bce" +checksum = "604fde5e028fea851ce1d8570bbdc034bec850d157f7569d10f347d06808c05c" dependencies = [ "proc-macro2", "quote", @@ -3060,9 +3059,9 @@ dependencies = [ [[package]] name = "matchit" -version = "0.7.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" [[package]] name = "md-5" @@ -3178,23 +3177,6 @@ dependencies = [ "syn", ] -[[package]] -name = "multer" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83e87776546dc87511aa5ee218730c92b666d7264ab6ed41f9d215af9cd5224b" -dependencies = [ - "bytes", - "encoding_rs", - "futures-util", - "http 1.2.0", - "httparse", - "memchr", - "mime", - "spin", - "version_check", -] - [[package]] name = "native-tls" version = "0.2.12" @@ -4441,9 +4423,9 @@ dependencies = [ [[package]] name = "sentry" -version = "0.35.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "016958f51b96861dead7c1e02290f138411d05e94fad175c8636a835dee6e51e" +checksum = "3a7332159e544e34db06b251b1eda5e546bd90285c3f58d9c8ff8450b484e0da" dependencies = [ "httpdate", "native-tls", @@ -4461,9 +4443,9 @@ dependencies = [ [[package]] name = "sentry-backtrace" -version = "0.35.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e57712c24e99252ef175b4b06c485294f10ad6bc5b5e1567ff3803ee7a0b7d3f" +checksum = "565ec31ad37bab8e6d9f289f34913ed8768347b133706192f10606dabd5c6bc4" dependencies = [ "backtrace", "once_cell", @@ -4473,9 +4455,9 @@ dependencies = [ [[package]] name = "sentry-contexts" -version = "0.35.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eba8754ec3b9279e00aa6d64916f211d44202370a1699afde1db2c16cbada089" +checksum = "e860275f25f27e8c0c7726ce116c7d5c928c5bba2ee73306e52b20a752298ea6" dependencies = [ "hostname", "libc", @@ -4487,9 +4469,9 @@ dependencies = [ [[package]] name = "sentry-core" -version = "0.35.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9f8b6dcd4fbae1e3e22b447f32670360b27e31b62ab040f7fb04e0f80c04d92" +checksum = "653942e6141f16651273159f4b8b1eaeedf37a7554c00cd798953e64b8a9bf72" dependencies = [ "once_cell", "rand", @@ -4500,9 +4482,9 @@ dependencies = [ [[package]] name = "sentry-debug-images" -version = "0.35.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8982a69133d3f5e4efdbfa0776937fca43c3a2e275a8fe184f50b1b0aa92e07c" +checksum = "2a60bc2154e6df59beed0ac13d58f8dfaf5ad20a88548a53e29e4d92e8e835c2" dependencies = [ "findshlibs", "once_cell", @@ -4511,9 +4493,9 @@ dependencies = [ [[package]] name = "sentry-panic" -version = "0.35.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de296dae6f01e931b65071ee5fe28d66a27909857f744018f107ed15fd1f6b25" +checksum = "105e3a956c8aa9dab1e4087b1657b03271bfc49d838c6ae9bfc7c58c802fd0ef" dependencies = [ "sentry-backtrace", "sentry-core", @@ -4521,9 +4503,9 @@ dependencies = [ [[package]] name = "sentry-tower" -version = "0.35.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdaf9b1939589476bd57751d12a9653bbfe356610fc476d03d7683189183ab7" +checksum = "082f781dfc504d984e16d99f8dbf94d6ee4762dd0fc28de25713d0f900a8164d" dependencies = [ "axum", "http 1.2.0", @@ -4536,9 +4518,9 @@ dependencies = [ [[package]] name = "sentry-tracing" -version = "0.35.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "263f73c757ed7915d3e1e34625eae18cad498a95b4261603d4ce3f87b159a6f0" +checksum = "64e75c831b4d8b34a5aec1f65f67c5d46a26c7c5d3c7abd8b5ef430796900cf8" dependencies = [ "sentry-backtrace", "sentry-core", @@ -4548,9 +4530,9 @@ dependencies = [ [[package]] name = "sentry-types" -version = "0.35.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a71ed3a389948a6a6d92b98e997a2723ca22f09660c5a7b7388ecd509a70a527" +checksum = "2d4203359e60724aa05cf2385aaf5d4f147e837185d7dd2b9ccf1ee77f4420c8" dependencies = [ "debugid", "hex", @@ -5591,9 +5573,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "utoipa" -version = "5.3.0" +version = "5.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68e76d357bc95c7d0939c92c04c9269871a8470eea39cb1f0231eeadb0c47d0f" +checksum = "435c6f69ef38c9017b4b4eea965dfb91e71e53d869e896db40d1cf2441dd75c0" dependencies = [ "indexmap", "serde", @@ -5603,9 +5585,9 @@ dependencies = [ [[package]] name = "utoipa-axum" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "839e89ad0db7f9e8737dace8ff43c1ce0711d5e0d08cc1c9d31cc8454d4643ee" +checksum = "ff0d605008ed085986e1803fd5c81d18c0f8503b1e4bbb21ea75b3fc20dd1efb" dependencies = [ "axum", "paste", diff --git a/Cargo.toml b/Cargo.toml index c9a1ca95b3b..17e8cb628e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,8 +48,8 @@ aws-credential-types = { version = "=1.2.1", features = ["hardcoded-credentials" aws-ip-ranges = "=0.964.0" aws-sdk-cloudfront = "=1.59.0" aws-sdk-sqs = "=1.53.0" -axum = { version = "=0.7.9", features = ["macros", "matched-path"] } -axum-extra = { version = "=0.9.6", features = ["erased-json", "query", "typed-header"] } +axum = { version = "=0.8.1", features = ["macros", "matched-path"] } +axum-extra = { version = "=0.10.0", features = ["erased-json", "query", "typed-header"] } base64 = "=0.22.1" bigdecimal = { version = "=0.4.7", features = ["serde"] } bon = "=3.3.2" @@ -107,7 +107,7 @@ reqwest = { version = "=0.12.12", features = ["gzip", "json"] } rss = { version = "=2.0.11", default-features = false, features = ["atom"] } secrecy = "=0.10.3" semver = { version = "=1.0.24", features = ["serde"] } -sentry = { version = "=0.35.0", features = ["tracing", "tower", "tower-axum-matched-path", "tower-http"] } +sentry = { version = "=0.36.0", features = ["tracing", "tower", "tower-axum-matched-path", "tower-http"] } serde = { version = "=1.0.217", features = ["derive"] } serde_json = "=1.0.135" sha2 = "=0.10.8" @@ -127,8 +127,8 @@ tracing-subscriber = { version = "=0.3.19", features = ["env-filter", "json"] } typomania = { version = "=0.1.2", default-features = false } url = "=2.5.4" unicode-xid = "=0.2.6" -utoipa = { version = "=5.3.0", features = ["chrono"] } -utoipa-axum = "=0.1.3" +utoipa = { version = "=5.3.1", features = ["chrono"] } +utoipa-axum = "=0.1.4" [dev-dependencies] bytes = "=1.9.0" diff --git a/crates/crates_io_session/Cargo.toml b/crates/crates_io_session/Cargo.toml index 84e44de40b9..62179aefcbc 100644 --- a/crates/crates_io_session/Cargo.toml +++ b/crates/crates_io_session/Cargo.toml @@ -8,8 +8,8 @@ edition = "2021" workspace = true [dependencies] -axum = { version = "=0.7.9", features = ["macros"] } -axum-extra = { version = "=0.9.6", features = ["cookie-signed"] } +axum = { version = "=0.8.1", features = ["macros"] } +axum-extra = { version = "=0.10.0", features = ["cookie-signed"] } base64 = "=0.22.1" cookie = { version = "=0.18.1", features = ["secure"] } parking_lot = "=0.12.3" diff --git a/crates/crates_io_worker/Cargo.toml b/crates/crates_io_worker/Cargo.toml index 2ba6688bdec..faa9b2a59a3 100644 --- a/crates/crates_io_worker/Cargo.toml +++ b/crates/crates_io_worker/Cargo.toml @@ -13,7 +13,7 @@ deadpool-diesel = { version = "=0.6.1", features = ["postgres", "tracing"] } diesel = { version = "=2.2.6", features = ["postgres", "serde_json"] } diesel-async = { version = "=0.5.2", features = ["async-connection-wrapper", "deadpool", "postgres"] } futures-util = "=0.3.31" -sentry-core = { version = "=0.35.0", features = ["client"] } +sentry-core = { version = "=0.36.0", features = ["client"] } serde = { version = "=1.0.217", features = ["derive"] } serde_json = "=1.0.135" thiserror = "=2.0.9" diff --git a/src/config/server.rs b/src/config/server.rs index 0262c4ce6bf..50f4fd66add 100644 --- a/src/config/server.rs +++ b/src/config/server.rs @@ -109,7 +109,7 @@ impl Server { /// - `FORCE_UNCONDITIONAL_REDIRECTS`: Whether to force unconditional redirects in the download /// endpoint even with a healthy database pool. /// - `BLOCKED_ROUTES`: A comma separated list of HTTP route patterns that are manually blocked - /// by an operator (e.g. `/crates/:crate_id/:version/download`). + /// by an operator (e.g. `/crates/{crate_id}/{version}/download`). /// /// # Panics /// diff --git a/src/controllers/helpers/pagination.rs b/src/controllers/helpers/pagination.rs index 83dd681b118..4820d95db21 100644 --- a/src/controllers/helpers/pagination.rs +++ b/src/controllers/helpers/pagination.rs @@ -558,10 +558,10 @@ mod tests { fn page_param_parsing() { let error = |query| pagination_error(PaginationOptions::builder(), query); - assert_snapshot!(error("page="), @"Failed to deserialize query string: cannot parse integer from empty string"); - assert_snapshot!(error("page=not_a_number"), @"Failed to deserialize query string: invalid digit found in string"); - assert_snapshot!(error("page=1.0"), @"Failed to deserialize query string: invalid digit found in string"); - assert_snapshot!(error("page=0"), @"Failed to deserialize query string: invalid value: integer `0`, expected a nonzero u32"); + assert_snapshot!(error("page="), @"Failed to deserialize query string: page: cannot parse integer from empty string"); + assert_snapshot!(error("page=not_a_number"), @"Failed to deserialize query string: page: invalid digit found in string"); + assert_snapshot!(error("page=1.0"), @"Failed to deserialize query string: page: invalid digit found in string"); + assert_snapshot!(error("page=0"), @"Failed to deserialize query string: page: invalid value: integer `0`, expected a nonzero u32"); let pagination = PaginationOptions::builder() .gather(&mock("page=5")) @@ -573,11 +573,11 @@ mod tests { fn per_page_param_parsing() { let error = |query| pagination_error(PaginationOptions::builder(), query); - assert_snapshot!(error("per_page="), @"Failed to deserialize query string: cannot parse integer from empty string"); - assert_snapshot!(error("per_page=not_a_number"), @"Failed to deserialize query string: invalid digit found in string"); - assert_snapshot!(error("per_page=1.0"), @"Failed to deserialize query string: invalid digit found in string"); + assert_snapshot!(error("per_page="), @"Failed to deserialize query string: per_page: cannot parse integer from empty string"); + assert_snapshot!(error("per_page=not_a_number"), @"Failed to deserialize query string: per_page: invalid digit found in string"); + assert_snapshot!(error("per_page=1.0"), @"Failed to deserialize query string: per_page: invalid digit found in string"); assert_snapshot!(error("per_page=101"), @"cannot request more than 100 items"); - assert_snapshot!(error("per_page=0"), @"Failed to deserialize query string: invalid value: integer `0`, expected a nonzero u32"); + assert_snapshot!(error("per_page=0"), @"Failed to deserialize query string: per_page: invalid value: integer `0`, expected a nonzero u32"); let pagination = PaginationOptions::builder() .gather(&mock("per_page=5")) diff --git a/src/controllers/metrics.rs b/src/controllers/metrics.rs index 06b27080bed..963d69ee0dc 100644 --- a/src/controllers/metrics.rs +++ b/src/controllers/metrics.rs @@ -6,7 +6,7 @@ use http::request::Parts; use http::{header, StatusCode}; use prometheus::TextEncoder; -/// Handles the `GET /api/private/metrics/:kind` endpoint. +/// Handles the `GET /api/private/metrics/{kind}` endpoint. pub async fn prometheus(app: AppState, Path(kind): Path, req: Parts) -> AppResult { if let Some(expected_token) = &app.config.metrics_authorization_token { let provided_token = req diff --git a/src/middleware/cargo_compat.rs b/src/middleware/cargo_compat.rs index 66d8abb63ec..f99199e4fe3 100644 --- a/src/middleware/cargo_compat.rs +++ b/src/middleware/cargo_compat.rs @@ -1,7 +1,7 @@ use axum::extract::{MatchedPath, Request, State}; use axum::middleware::Next; use axum::response::{IntoResponse, Response}; -use axum::{Extension, Json}; +use axum::Json; use http::{header, Method, StatusCode}; use std::str::FromStr; @@ -36,12 +36,13 @@ impl FromStr for StatusCodeConfig { /// Convert plain text errors into JSON errors and adjust status codes. pub async fn middleware( State(config): State, - matched_path: Option>, req: Request, next: Next, ) -> Response { let is_api_request = req.uri().path().starts_with("/api/"); - let is_cargo_endpoint = matched_path + let is_cargo_endpoint = req + .extensions() + .get::() .map(|m| is_cargo_endpoint(req.method(), m.as_str())) .unwrap_or(false); @@ -75,11 +76,11 @@ pub async fn middleware( fn is_cargo_endpoint(method: &Method, path: &str) -> bool { const CARGO_ENDPOINTS: &[(Method, &str)] = &[ (Method::PUT, "/api/v1/crates/new"), - (Method::DELETE, "/api/v1/crates/:crate_id/:version/yank"), - (Method::PUT, "/api/v1/crates/:crate_id/:version/unyank"), - (Method::GET, "/api/v1/crates/:crate_id/owners"), - (Method::PUT, "/api/v1/crates/:crate_id/owners"), - (Method::DELETE, "/api/v1/crates/:crate_id/owners"), + (Method::DELETE, "/api/v1/crates/{crate_id}/{version}/yank"), + (Method::PUT, "/api/v1/crates/{crate_id}/{version}/unyank"), + (Method::GET, "/api/v1/crates/{crate_id}/owners"), + (Method::PUT, "/api/v1/crates/{crate_id}/owners"), + (Method::DELETE, "/api/v1/crates/{crate_id}/owners"), (Method::GET, "/api/v1/crates"), ]; @@ -154,7 +155,7 @@ mod tests { .route("/500", internal) .route("/api/v1/crates/new", put(|| async { StatusCode::CREATED })) .route( - "/api/v1/crates/:crate_id/owners", + "/api/v1/crates/{crate_id}/owners", get(|| async { StatusCode::INTERNAL_SERVER_ERROR }), ) .layer(from_fn_with_state(StatusCodeConfig::AdjustAll, middleware)) diff --git a/src/router.rs b/src/router.rs index 50776d671de..0ce568e6137 100644 --- a/src/router.rs +++ b/src/router.rs @@ -91,7 +91,7 @@ pub fn build_axum_router(state: AppState) -> Router<()> { let mut router = router // Metrics - .route("/api/private/metrics/:kind", get(metrics::prometheus)) + .route("/api/private/metrics/{kind}", get(metrics::prometheus)) // Alerts from GitHub scanning for exposed API tokens .route( "/api/github/secret-scanning/verify", diff --git a/src/tests/blocked_routes.rs b/src/tests/blocked_routes.rs index bca35c93607..485291121c2 100644 --- a/src/tests/blocked_routes.rs +++ b/src/tests/blocked_routes.rs @@ -32,7 +32,7 @@ async fn test_blocked_download_route() { config.blocked_routes.clear(); config .blocked_routes - .insert("/api/v1/crates/:name/:version/download".into()); + .insert("/api/v1/crates/{name}/{version}/download".into()); }) .with_user() .await; diff --git a/src/tests/routes/crates/list.rs b/src/tests/routes/crates/list.rs index 1ea73b4a194..6881081d956 100644 --- a/src/tests/routes/crates/list.rs +++ b/src/tests/routes/crates/list.rs @@ -1172,13 +1172,13 @@ async fn pagination_parameters_only_accept_integers() { .get_with_query::<()>("/api/v1/crates", "page=1&per_page=100%22%EF%BC%8Cexception") .await; assert_eq!(response.status(), StatusCode::BAD_REQUEST); - assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"Failed to deserialize query string: invalid digit found in string"}]}"#); + assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"Failed to deserialize query string: per_page: invalid digit found in string"}]}"#); let response = anon .get_with_query::<()>("/api/v1/crates", "page=100%22%EF%BC%8Cexception&per_page=1") .await; assert_eq!(response.status(), StatusCode::BAD_REQUEST); - assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"Failed to deserialize query string: invalid digit found in string"}]}"#); + assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"Failed to deserialize query string: page: invalid digit found in string"}]}"#); } #[tokio::test(flavor = "multi_thread")] diff --git a/src/tests/routes/crates/owners/add.rs b/src/tests/routes/crates/owners/add.rs index 9383f46b626..f2aa0a8f02c 100644 --- a/src/tests/routes/crates/owners/add.rs +++ b/src/tests/routes/crates/owners/add.rs @@ -7,7 +7,7 @@ use insta::assert_snapshot; // This is testing Cargo functionality! ! ! // specifically functions modify_owners and add_owners -// which call the `PUT /crates/:crate_id/owners` route +// which call the `PUT /crates/{crate_id}/owners` route #[tokio::test(flavor = "multi_thread")] async fn test_cargo_invite_owners() { let (app, _, owner) = TestApp::init().with_user().await; diff --git a/src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes-2.snap b/src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes-2.snap index 17510170d5d..4de6ee5d395 100644 --- a/src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes-2.snap +++ b/src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes-2.snap @@ -5,7 +5,7 @@ expression: response.json() { "errors": [ { - "detail": "Failed to deserialize query string: string contains null byte" + "detail": "Failed to deserialize query string: category: string contains null byte" } ] } diff --git a/src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes-3.snap b/src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes-3.snap index 17510170d5d..49271233ec6 100644 --- a/src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes-3.snap +++ b/src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes-3.snap @@ -5,7 +5,7 @@ expression: response.json() { "errors": [ { - "detail": "Failed to deserialize query string: string contains null byte" + "detail": "Failed to deserialize query string: all_keywords: string contains null byte" } ] } diff --git a/src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes-4.snap b/src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes-4.snap index 17510170d5d..0537cf75bbc 100644 --- a/src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes-4.snap +++ b/src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes-4.snap @@ -5,7 +5,7 @@ expression: response.json() { "errors": [ { - "detail": "Failed to deserialize query string: string contains null byte" + "detail": "Failed to deserialize query string: keyword: string contains null byte" } ] } diff --git a/src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes-5.snap b/src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes-5.snap index 17510170d5d..573259276e0 100644 --- a/src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes-5.snap +++ b/src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes-5.snap @@ -5,7 +5,7 @@ expression: response.json() { "errors": [ { - "detail": "Failed to deserialize query string: string contains null byte" + "detail": "Failed to deserialize query string: letter: string contains null byte" } ] } diff --git a/src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes.snap b/src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes.snap index 17510170d5d..a4da26183d6 100644 --- a/src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes.snap +++ b/src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes.snap @@ -5,7 +5,7 @@ expression: response.json() { "errors": [ { - "detail": "Failed to deserialize query string: string contains null byte" + "detail": "Failed to deserialize query string: q: string contains null byte" } ] } diff --git a/src/tests/routes/me/updates.rs b/src/tests/routes/me/updates.rs index c9936dbcefc..12e497bbfea 100644 --- a/src/tests/routes/me/updates.rs +++ b/src/tests/routes/me/updates.rs @@ -103,5 +103,5 @@ async fn following() { .get_with_query::<()>("/api/v1/me/updates", "page=0") .await; assert_eq!(response.status(), StatusCode::BAD_REQUEST); - assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"Failed to deserialize query string: invalid value: integer `0`, expected a nonzero u32"}]}"#); + assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"Failed to deserialize query string: page: invalid value: integer `0`, expected a nonzero u32"}]}"#); } diff --git a/src/tests/routes/users/read.rs b/src/tests/routes/users/read.rs index b77be12ec33..57e97a8636b 100644 --- a/src/tests/routes/users/read.rs +++ b/src/tests/routes/users/read.rs @@ -32,7 +32,7 @@ async fn show_latest_user_case_insensitively() { // available for anyone to take. We need to support having multiple user accounts // with the same gh_login in crates.io. `gh_id` is stable across renames, so that field // should be used for uniquely identifying GitHub accounts whenever possible. For the - // crates.io/user/:username pages, the best we can do is show the last crates.io account + // crates.io/user/{username} pages, the best we can do is show the last crates.io account // created with that username. let user1 = NewUser::new( diff --git a/src/tests/user.rs b/src/tests/user.rs index 126fcb71c28..a9694e3364f 100644 --- a/src/tests/user.rs +++ b/src/tests/user.rs @@ -134,7 +134,7 @@ async fn github_with_email_does_not_overwrite_email() -> anyhow::Result<()> { } /// Given a crates.io user, check that the user's email can be -/// updated in the database (PUT /user/:user_id), then check +/// updated in the database (PUT /user/{user_id}), then check /// that the updated email is sent back to the user (GET /me). #[tokio::test(flavor = "multi_thread")] async fn test_email_get_and_put() -> anyhow::Result<()> { @@ -155,7 +155,7 @@ async fn test_email_get_and_put() -> anyhow::Result<()> { /// Given a new user, test that their email can be added /// to the email table and a token for the email is generated -/// and added to the token table. When /confirm/:email_token is +/// and added to the token table. When /confirm/{email_token} is /// requested, check that the response back is ok, and that /// the email_verified field on user is now set to true. #[tokio::test(flavor = "multi_thread")]