From 6ff4da7ccdc2a94ec08b1b17cda0111fc2fe66df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8A=89=E5=AE=89?= Date: Fri, 25 Sep 2020 17:53:17 +0800 Subject: [PATCH] Append @robjtede changes request in PR #1695 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rewrite comments & changes Signed-off-by: 劉安 --- CHANGES.md | 2 +- src/middleware/normalize.rs | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 96a81a03c..608c237b2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,7 +3,7 @@ ## Unreleased - 2020-xx-xx ### Changed * Add `TrailingSlash::MergeOnly` behaviour to `NormalizePath`, which allow `NormalizePath` - to keep the trailing slash's existance as it is. fix [#1694] [#1695] + to keep the trailing slash's existance as it is. [#1695] ## 3.0.2 - 2020-09-15 diff --git a/src/middleware/normalize.rs b/src/middleware/normalize.rs index 309c113fe..e0ecd90dc 100644 --- a/src/middleware/normalize.rs +++ b/src/middleware/normalize.rs @@ -17,8 +17,9 @@ pub enum TrailingSlash { /// Always add a trailing slash to the end of the path. /// This will require all routes to end in a trailing slash for them to be accessible. Always, - /// Neither add nor trim slash at end of path. Merge multiple slashes only - /// This is compatible with actix-web 2.0 + /// Only merge any present multiple trailing slashes. + /// + /// Note: This option provides the best compatibility with the v2 version of this middlware. MergeOnly, /// Trim trailing slashes from the end of the path. Trim, @@ -36,7 +37,8 @@ impl Default for TrailingSlash { /// Performs following: /// /// - Merges multiple slashes into one. -/// - Appends a trailing slash if one is not present, or removes one if present, or keep trailing slash's existance as it was, depending on the supplied `TrailingSlash`. +/// - Appends a trailing slash if one is not present, removes one if present, or keeps trailing +/// slashes as-is, depending on the supplied `TrailingSlash` variant. /// /// ```rust /// use actix_web::{web, http, middleware, App, HttpResponse};