From a4546f02d2924b23c689cf08f47341b885aece80 Mon Sep 17 00:00:00 2001 From: Damian Lesiuk Date: Sun, 13 Sep 2020 01:55:39 +0200 Subject: [PATCH 1/2] make TrailingSlash enum accessible (#1673) Co-authored-by: Damian Lesiuk --- .gitignore | 3 +++ CHANGES.md | 3 ++- src/middleware/mod.rs | 2 +- tests/test_server.rs | 17 ++++++++++++++++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 11a3b5f37..638a4397a 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,6 @@ guide/build/ # These are backup files generated by rustfmt **/*.rs.bk + +# Configuration directory generated by CLion +.idea diff --git a/CHANGES.md b/CHANGES.md index 995ef884a..bc5f7136f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,8 @@ # Changes ## Unreleased - 2020-xx-xx - +### Changed +* `middleware::normalize::TrailingSlash` enum is now accessible. [#1673] ## 3.0.0 - 2020-09-11 * No significant changes from `3.0.0-beta.4`. diff --git a/src/middleware/mod.rs b/src/middleware/mod.rs index f0d42cc2a..12c12a98c 100644 --- a/src/middleware/mod.rs +++ b/src/middleware/mod.rs @@ -9,7 +9,7 @@ mod condition; mod defaultheaders; pub mod errhandlers; mod logger; -mod normalize; +pub mod normalize; pub use self::condition::Condition; pub use self::defaultheaders::DefaultHeaders; diff --git a/tests/test_server.rs b/tests/test_server.rs index fa8a93f06..f8a9ab86d 100644 --- a/tests/test_server.rs +++ b/tests/test_server.rs @@ -16,7 +16,8 @@ use futures_util::ready; use rand::{distributions::Alphanumeric, Rng}; use actix_web::dev::BodyEncoding; -use actix_web::middleware::Compress; +use actix_web::middleware::normalize::TrailingSlash; +use actix_web::middleware::{Compress, NormalizePath}; use actix_web::{dev, test, web, App, Error, HttpResponse}; const STR: &str = "Hello World Hello World Hello World Hello World Hello World \ @@ -866,6 +867,20 @@ async fn test_slow_request() { assert!(data.starts_with("HTTP/1.1 408 Request Timeout")); } +#[actix_rt::test] +async fn test_normalize() { + let srv = test::start_with(test::config().h1(), || { + App::new() + .wrap(NormalizePath::new(TrailingSlash::Trim)) + .service( + web::resource("/one").route(web::to(|| HttpResponse::Ok().finish())), + ) + }); + + let response = srv.get("/one/").send().await.unwrap(); + assert!(response.status().is_success()); +} + // #[cfg(feature = "openssl")] // #[actix_rt::test] // async fn test_ssl_handshake_timeout() { From f8615087893863a35f3e835068dd833ce5c5af5b Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sun, 13 Sep 2020 03:24:44 +0100 Subject: [PATCH 2/2] prepare web release 3.0.1 (#1676) --- CHANGES.md | 6 ++++++ Cargo.toml | 4 ++-- src/lib.rs | 8 +++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index bc5f7136f..aadf627bc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,9 +1,15 @@ # Changes ## Unreleased - 2020-xx-xx + + +## 3.0.1 - 2020-09-13 ### Changed * `middleware::normalize::TrailingSlash` enum is now accessible. [#1673] +[#1673]: https://github.com/actix/actix-web/pull/1673 + + ## 3.0.0 - 2020-09-11 * No significant changes from `3.0.0-beta.4`. diff --git a/Cargo.toml b/Cargo.toml index ce33097be..b2cffbc48 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "actix-web" -version = "3.0.0" +version = "3.0.1" authors = ["Nikolay Kim "] -description = "Actix web is a simple, pragmatic and extremely fast web framework for Rust." +description = "Actix web is a powerful, pragmatic, and extremely fast web framework for Rust." readme = "README.md" keywords = ["actix", "http", "web", "framework", "async"] homepage = "https://actix.rs" diff --git a/src/lib.rs b/src/lib.rs index 0eced5b42..327cba954 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,3 @@ -#![deny(rust_2018_idioms)] -#![allow(clippy::needless_doctest_main, clippy::type_complexity)] - //! Actix web is a powerful, pragmatic, and extremely fast web framework for Rust. //! //! ## Example @@ -68,6 +65,11 @@ //! * `rustls` - HTTPS support via `rustls` crate, supports `HTTP/2` //! * `secure-cookies` - secure cookies support +#![deny(rust_2018_idioms)] +#![allow(clippy::needless_doctest_main, clippy::type_complexity)] +#![doc(html_logo_url = "https://actix.rs/img/logo.png")] +#![doc(html_favicon_url = "https://actix.rs/favicon.ico")] + mod app; mod app_service; mod config;