1
0
Fork 0
mirror of https://github.com/tokio-rs/axum.git synced 2025-04-26 13:56:22 +02:00

Remove some unnecessary dependencies

This commit is contained in:
David Pedersen 2021-06-08 22:27:38 +02:00
parent 1cf78fa807
commit 21872c9f7a
3 changed files with 20 additions and 18 deletions

View file

@ -11,16 +11,14 @@ futures-util = "0.3"
http = "0.2"
http-body = "0.4"
hyper = "0.14"
itertools = "0.10"
pin-project = "1.0"
regex = "1.5"
serde = "1.0"
serde_json = "1.0"
serde_urlencoded = "0.7"
thiserror = "1.0"
tokio = { version = "1", features = ["time"] }
tower = { version = "0.4", features = ["util", "buffer"] }
tower-http = { version = "0.1", features = ["add-extension"] }
regex = "1.5"
tokio = { version = "1", features = ["time"] }
[dev-dependencies]
hyper = { version = "0.14", features = ["full"] }
@ -36,10 +34,10 @@ uuid = "0.8"
version = "0.1"
features = [
"add-extension",
"auth",
"compression",
"compression-full",
"fs",
"trace",
"redirect",
"auth",
"trace",
]

View file

@ -3,6 +3,7 @@
use bytes::Bytes;
use http_body::{Empty, Full};
use std::{
error::Error as StdError,
fmt,
pin::Pin,
task::{Context, Poll},
@ -86,14 +87,17 @@ where
///
/// This is necessary for compatibility with middleware that changes the error
/// type of the response body.
// work around for `BoxError` not implementing `std::error::Error`
//
// This is currently required since tower-http's Compression middleware's body type's
// error only implements error when the inner error type does:
// https://github.com/tower-rs/tower-http/blob/master/tower-http/src/lib.rs#L310
//
// Fixing that is a breaking change to tower-http so we should wait a bit, but should
// totally fix it at some point.
#[derive(Debug, thiserror::Error)]
#[error(transparent)]
pub struct BoxStdError(#[from] pub(crate) tower::BoxError);
#[derive(Debug)]
pub struct BoxStdError(pub(crate) tower::BoxError);
impl StdError for BoxStdError {
fn source(&self) -> std::option::Option<&(dyn StdError + 'static)> {
self.0.source()
}
}
impl fmt::Display for BoxStdError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.0.fmt(f)
}
}

View file

@ -6,7 +6,6 @@ use futures_util::{future, ready};
use http::{Method, Request, Response, StatusCode, Uri};
use http_body::Full;
use hyper::Body;
use itertools::Itertools;
use pin_project::pin_project;
use regex::Regex;
use std::{
@ -394,6 +393,7 @@ impl PathPattern {
Cow::Borrowed(part)
}
})
.collect::<Vec<_>>()
.join("/");
let full_path_regex =