Skip to content

Commit

Permalink
chore(deps): bump axum from 0.7.9 to 0.8.1 (#154)
Browse files Browse the repository at this point in the history
Bumps [axum](https://github.com/tokio-rs/axum) from 0.7.9 to 0.8.1.
- [Release notes](https://github.com/tokio-rs/axum/releases)
- [Changelog](https://github.com/tokio-rs/axum/blob/main/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/axum/commits)

---
updated-dependencies:
- dependency-name: axum
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

fix: Breaking changes in Axum (#154)
    - Swap to new `matchit` syntax for Router
    - Swap to `axum_extra::extract::Host`
    - Use `Result<Host, HostRejection>` instead of (no longer working
       tokio-rs/axum#3170) `Option<Host>` to
       swallow missing Host header
  • Loading branch information
dependabot[bot] authored Mar 3, 2025
1 parent 7b90e86 commit 9372d1b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 17 deletions.
40 changes: 30 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async-trait = "0.1.85"
pin-project = "1.1.8"
futures = "0.3.31"
time = { version = "0.3.37", features = ["formatting"] }
axum = { version = "0.7.9", default-features = false, features = ["multipart","macros", "tokio", "http1", "json"] }
axum = { version = "0.8.1", default-features = false, features = ["multipart","macros", "tokio", "http1", "json"] }
tokio = { version = "1.43.0", features = ["macros", "rt-multi-thread", "signal", "time"] }
tokio-util = "0.7.13"

Expand All @@ -60,6 +60,7 @@ opentelemetry = { version = "0.27.1", default-features = false, features = ["tra
opentelemetry_sdk = { version = "0.27.1", default-features = false, features = ["trace"], optional = true }
tracing-core = {version = "0.1.32", optional = true }
prost = {version = "0.13.4", optional = true }
axum-extra = { version = "0.10.0", default-features = false }



Expand Down
13 changes: 7 additions & 6 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use axum::{
routing::{get, post},
Json, Router,
};
use axum_extra::extract::{rejection::HostRejection, Host};
use http::{header::CACHE_CONTROL, HeaderValue, StatusCode};
use serde::{ser::SerializeMap, Serialize, Serializer};
use tracing::{debug, info_span, Instrument};
Expand Down Expand Up @@ -63,17 +64,17 @@ pub fn router(env: Env) -> Router {
get(|| async { Redirect::to(env!("CARGO_PKG_HOMEPAGE")) })
.layer(axum::middleware::from_fn(cache_control_middleware)),
)
.route("/:registry/:namespace/:package/", get(list_package))
.route("/{registry}/{namespace}/{package}/", get(list_package))
.route(
"/:registry/:namespace/:package/json",
"/{registry}/{namespace}/{package}/json",
get(list_package_json),
)
.route(
"/:registry/:namespace/:package/:filename",
"/{registry}/{namespace}/{package}/{filename}",
get(download_package).delete(delete_package_version),
)
.route(
"/:registry/:namespace/",
"/{registry}/{namespace}/",
post(publish_package).layer(DefaultBodyLimit::max(env.body_limit)),
);
let router = match env.path {
Expand Down Expand Up @@ -110,7 +111,7 @@ async fn cache_control_middleware(
/// Log incoming requests
async fn accesslog_middleware(
method: axum::http::Method,
host: Option<axum::extract::Host>,
host: Result<Host, HostRejection>,
uri: axum::http::Uri,
headers: axum::http::HeaderMap,
request: axum::extract::Request,
Expand All @@ -125,7 +126,7 @@ async fn accesslog_middleware(

tracing::debug!("Accept: {:?}", headers);
tracing::info!(
host = host.map(|value| value.0),
host = host.map(|value| value.0).unwrap_or("".to_string()),
"type" = "request",
status,
method = method.to_string(),
Expand Down

0 comments on commit 9372d1b

Please sign in to comment.