1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-30 00:14:58 +02:00

make TrailingSlash enum accessible (#1673)

Co-authored-by: Damian Lesiuk <lesiuk@sabre.com>
This commit is contained in:
Damian Lesiuk
2020-09-13 01:55:39 +02:00
committed by GitHub
parent 64a2c13cdf
commit a4546f02d2
4 changed files with 22 additions and 3 deletions

View File

@ -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() {