Merge branch 'jplatte/up-axum' into 'next'

Upgrade axum to 0.5

See merge request famedly/conduit!335
This commit is contained in:
Timo Kösters 2022-04-01 08:33:22 +00:00
commit 7bc84dc971
3 changed files with 10 additions and 11 deletions

15
Cargo.lock generated
View File

@ -124,9 +124,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "axum"
version = "0.4.4"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "310a147401c66e79fc78636e4db63ac68cd6acb9ece056de806ea173a15bce32"
checksum = "5611d4977882c5af1c0f7a34d51b5d87f784f86912bb543986b014ea4995ef93"
dependencies = [
"async-trait",
"axum-core",
@ -137,6 +137,7 @@ dependencies = [
"http",
"http-body",
"hyper",
"itoa 1.0.1",
"matchit",
"memchr",
"mime",
@ -144,10 +145,8 @@ dependencies = [
"pin-project-lite",
"serde",
"serde_json",
"serde_urlencoded",
"sync_wrapper",
"tokio",
"tokio-util",
"tower",
"tower-http",
"tower-layer",
@ -156,9 +155,9 @@ dependencies = [
[[package]]
name = "axum-core"
version = "0.1.1"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ca6c0b218388a7ed6a8d25e94f7dea5498daaa4fd8c711fb3ff166041b06fda"
checksum = "95cd109b3e93c9541dcce5b0219dcf89169dcc58c1bebed65082808324258afb"
dependencies = [
"async-trait",
"bytes",
@ -1427,9 +1426,9 @@ checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
[[package]]
name = "matchit"
version = "0.4.4"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58b6f41fdfbec185dd3dff58b51e323f5bc61692c0de38419a957b0dcfccca3c"
checksum = "73cbba799671b762df5a175adf59ce145165747bb891505c43d09aefbbf38beb"
[[package]]
name = "memchr"

View File

@ -14,7 +14,7 @@ edition = "2021"
[dependencies]
# Web framework
axum = { version = "0.4.4", features = ["headers"], optional = true }
axum = { version = "0.5.0", default-features = false, features = ["headers", "http1", "http2", "json", "matched-path"], optional = true }
axum-server = { version = "0.3.3", features = ["tls-rustls"] }
tower = { version = "0.4.11", features = ["util"] }
tower-http = { version = "0.2.1", features = ["add-extension", "cors", "compression-full", "sensitive-headers", "trace", "util"] }

View File

@ -154,6 +154,7 @@ where
TypedHeaderRejectionReason::Error(_) => {
"Invalid X-Matrix signatures."
}
_ => "Unknown header-related error",
};
Error::BadRequest(ErrorKind::Forbidden, msg)
@ -247,8 +248,7 @@ where
};
let mut http_request = http::Request::builder().uri(req.uri()).method(req.method());
*http_request.headers_mut().unwrap() =
req.headers().expect("Headers already extracted").clone();
*http_request.headers_mut().unwrap() = req.headers().clone();
if let Some(CanonicalJsonValue::Object(json_body)) = &mut json_body {
let user_id = sender_user.clone().unwrap_or_else(|| {