mirror of https://github.com/fafhrd91/actix-web
soft deprecate `NormalizePath::default`
This commit is contained in:
parent
c9c36679e4
commit
65aa3502cc
|
@ -1,6 +1,10 @@
|
||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
## Unreleased - 2020-xx-xx
|
## Unreleased - 2020-xx-xx
|
||||||
|
### Changed
|
||||||
|
* Soft-deprecate `NormalizePath::default()`, noting upcoming behavior change in v4. [#2529]
|
||||||
|
|
||||||
|
[#2529]: https://github.com/actix/actix-web/pull/2529
|
||||||
|
|
||||||
|
|
||||||
## 3.3.2 - 2020-12-01
|
## 3.3.2 - 2020-12-01
|
||||||
|
|
|
@ -55,7 +55,7 @@ impl Error {
|
||||||
|
|
||||||
/// Similar to `as_response_error` but downcasts.
|
/// Similar to `as_response_error` but downcasts.
|
||||||
pub fn as_error<T: ResponseError + 'static>(&self) -> Option<&T> {
|
pub fn as_error<T: ResponseError + 'static>(&self) -> Option<&T> {
|
||||||
ResponseError::downcast_ref(self.cause.as_ref())
|
<dyn ResponseError>::downcast_ref(self.cause.as_ref())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ impl Default for TrailingSlash {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
/// `Middleware` to normalize request's URI in place
|
/// `Middleware` to normalize request's URI in place
|
||||||
///
|
///
|
||||||
/// Performs following:
|
/// Performs following:
|
||||||
|
@ -56,6 +56,18 @@ impl Default for TrailingSlash {
|
||||||
|
|
||||||
pub struct NormalizePath(TrailingSlash);
|
pub struct NormalizePath(TrailingSlash);
|
||||||
|
|
||||||
|
impl Default for NormalizePath {
|
||||||
|
fn default() -> Self {
|
||||||
|
log::warn!(
|
||||||
|
"`NormalizePath::default()` is deprecated. The default trailing slash behavior will \
|
||||||
|
change in v4 from `Always` to `Trim`. Update your call to `NormalizePath::new(...)` to \
|
||||||
|
avoid inaccessible routes when upgrading."
|
||||||
|
);
|
||||||
|
|
||||||
|
Self(TrailingSlash::default())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl NormalizePath {
|
impl NormalizePath {
|
||||||
/// Create new `NormalizePath` middleware with the specified trailing slash style.
|
/// Create new `NormalizePath` middleware with the specified trailing slash style.
|
||||||
pub fn new(trailing_slash_style: TrailingSlash) -> Self {
|
pub fn new(trailing_slash_style: TrailingSlash) -> Self {
|
||||||
|
|
Loading…
Reference in New Issue