From e6f1e01707ab8695add56ee821b41105e24b78e3 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Tue, 5 Jan 2021 03:09:08 +0000 Subject: [PATCH] update changelog --- CHANGES.md | 6 +++--- examples/basic.rs | 3 +-- src/middleware/default_headers.rs | 2 +- src/middleware/normalize.rs | 17 ++++------------- 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 82ac78388..f0b55801b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,8 +11,8 @@ * Update `rust-tls` to `0.19`. [#1813] * Rename `Handler` to `HandlerService` and rename `Factory` to `Handler`. [#1852] * The default `TrailingSlash` is now `Trim`, in line with existing documentation. See migration - guide for implications. [#????] -* Rename `DefaultHeaders::{content_type => add_content_type}`. [#????] + guide for implications. [#1875] +* Rename `DefaultHeaders::{content_type => add_content_type}`. [#1875] * MSRV is now 1.46.0. ### Fixed @@ -26,7 +26,7 @@ [#1813]: https://github.com/actix/actix-web/pull/1813 [#1852]: https://github.com/actix/actix-web/pull/1852 [#1865]: https://github.com/actix/actix-web/pull/1865 -[#????]: https://github.com/actix/actix-web/pull/???? +[#1875]: https://github.com/actix/actix-web/pull/1875 ## 3.3.2 - 2020-12-01 diff --git a/examples/basic.rs b/examples/basic.rs index 8b2bf2319..e8ad5fcdb 100644 --- a/examples/basic.rs +++ b/examples/basic.rs @@ -18,8 +18,7 @@ async fn no_params() -> &'static str { #[actix_web::main] async fn main() -> std::io::Result<()> { - std::env::set_var("RUST_LOG", "actix_server=info,actix_web=info"); - env_logger::init(); + env_logger::init_from_env(env_logger::Env::new().default_filter_or("info")); HttpServer::new(|| { App::new() diff --git a/src/middleware/default_headers.rs b/src/middleware/default_headers.rs index 02fb5d6b6..6f027124f 100644 --- a/src/middleware/default_headers.rs +++ b/src/middleware/default_headers.rs @@ -9,13 +9,13 @@ use std::{ task::{Context, Poll}, }; -use actix_service::{Service, Transform}; use futures_util::{ future::{ready, Ready}, ready, }; use crate::{ + dev::{Service, Transform}, http::{ header::{HeaderName, HeaderValue, CONTENT_TYPE}, Error as HttpError, HeaderMap, diff --git a/src/middleware/normalize.rs b/src/middleware/normalize.rs index fc0ae80d7..89cab9073 100644 --- a/src/middleware/normalize.rs +++ b/src/middleware/normalize.rs @@ -48,9 +48,10 @@ impl Default for TrailingSlash { /// to [`new`](NormalizePath::new()). /// /// # Default Behavior -/// The default constructor chooses to append trailing slashes to the end of paths without them -/// ([`TrailingSlash::Always`]), the effect is that route definitions should be defined with -/// trailing slashes or else they will be inaccessible, or vice versa when using the trim behavior. +/// The default constructor chooses to strip trailing slashes from the end of paths with them +/// ([`TrailingSlash::Trim`]). The implication is that route definitions should be defined without +/// trailing slashes or else they will be inaccessible (or vice versa when using the +/// `TrailingSlash::Always` behavior), as shown in the example tests below. /// /// # Usage /// ```rust @@ -92,16 +93,6 @@ impl NormalizePath { pub fn new(trailing_slash_style: TrailingSlash) -> Self { NormalizePath(trailing_slash_style) } - - /// Shortcut for new `NormalizePath::new(TrailingSlash::Trim)`. - pub fn trim() -> Self { - NormalizePath::new(TrailingSlash::Trim) - } - - /// Shortcut for new `NormalizePath::new(TrailingSlash::MergeOnly)`. - pub fn merge_only() -> Self { - NormalizePath::new(TrailingSlash::MergeOnly) - } } impl Transform for NormalizePath