From 99ff9cdc6890959cd4d2112c2e37b97ae83cb43c Mon Sep 17 00:00:00 2001 From: Vika Date: Sun, 9 Jul 2023 22:22:34 +0300 Subject: cargo update, part 2: Axum MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Axum got some breaking changes and gained some nice features — however, features come later, breaking changes come first. Perhaps it would be nice to actually construct a State with all of my stuff, and then make functions generic over that. Could reduce the amount of generic stuff I am producing... maybe. --- kittybox-rs/src/micropub/mod.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'kittybox-rs/src/micropub') diff --git a/kittybox-rs/src/micropub/mod.rs b/kittybox-rs/src/micropub/mod.rs index 9351603..04bf0a5 100644 --- a/kittybox-rs/src/micropub/mod.rs +++ b/kittybox-rs/src/micropub/mod.rs @@ -497,9 +497,9 @@ async fn dispatch_body( pub(crate) async fn post( Extension(db): Extension, Extension(http): Extension, + TypedHeader(content_type): TypedHeader, user: User, body: BodyStream, - TypedHeader(content_type): TypedHeader, ) -> axum::response::Response { match dispatch_body(body, content_type).await { Ok(PostBody::Action(action)) => match post_action(action, db, user).await { @@ -639,15 +639,15 @@ where { axum::routing::get(query::) .post(post::) - .layer(tower_http::cors::CorsLayer::new() + .layer::<_, _, std::convert::Infallible>(tower_http::cors::CorsLayer::new() .allow_methods([ axum::http::Method::GET, axum::http::Method::POST, ]) .allow_origin(tower_http::cors::Any)) - .layer(axum::Extension(storage)) - .layer(axum::Extension(http)) - .layer(axum::Extension(auth)) + .layer::<_, _, std::convert::Infallible>(axum::Extension(storage)) + .layer::<_, _, std::convert::Infallible>(axum::Extension(http)) + .layer::<_, _, std::convert::Infallible>(axum::Extension(auth)) } #[cfg(test)] -- cgit 1.4.1