1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-26 15:07:42 +02:00

migrate to -utils beta 4 (#2127)

This commit is contained in:
Rob Ede
2021-04-01 15:26:13 +01:00
committed by GitHub
parent a807d33600
commit c8ed8dd1a4
64 changed files with 612 additions and 210 deletions

View File

@ -8,10 +8,10 @@ use actix_http::http::{Method, StatusCode, Version};
use actix_http::{body, error, Error, HttpService, Request, Response};
use actix_http_test::test_server;
use actix_service::{fn_factory_with_config, fn_service};
use actix_utils::future::{err, ok};
use bytes::{Bytes, BytesMut};
use futures_core::Stream;
use futures_util::future::{self, err, ok};
use futures_util::stream::{once, StreamExt as _};
use rustls::{
internal::pemfile::{certs, pkcs8_private_keys},
@ -51,7 +51,7 @@ fn tls_config() -> RustlsServerConfig {
async fn test_h1() -> io::Result<()> {
let srv = test_server(move || {
HttpService::build()
.h1(|_| future::ok::<_, Error>(Response::Ok().finish()))
.h1(|_| ok::<_, Error>(Response::Ok().finish()))
.rustls(tls_config())
})
.await;
@ -65,7 +65,7 @@ async fn test_h1() -> io::Result<()> {
async fn test_h2() -> io::Result<()> {
let srv = test_server(move || {
HttpService::build()
.h2(|_| future::ok::<_, Error>(Response::Ok().finish()))
.h2(|_| ok::<_, Error>(Response::Ok().finish()))
.rustls(tls_config())
})
.await;
@ -82,7 +82,7 @@ async fn test_h1_1() -> io::Result<()> {
.h1(|req: Request| {
assert!(req.peer_addr().is_some());
assert_eq!(req.version(), Version::HTTP_11);
future::ok::<_, Error>(Response::Ok().finish())
ok::<_, Error>(Response::Ok().finish())
})
.rustls(tls_config())
})
@ -100,7 +100,7 @@ async fn test_h2_1() -> io::Result<()> {
.finish(|req: Request| {
assert!(req.peer_addr().is_some());
assert_eq!(req.version(), Version::HTTP_2);
future::ok::<_, Error>(Response::Ok().finish())
ok::<_, Error>(Response::Ok().finish())
})
.rustls(tls_config())
})
@ -144,7 +144,7 @@ async fn test_h2_content_length() {
StatusCode::OK,
StatusCode::NOT_FOUND,
];
future::ok::<_, ()>(Response::new(statuses[indx]))
ok::<_, ()>(Response::new(statuses[indx]))
})
.rustls(tls_config())
})
@ -213,7 +213,7 @@ async fn test_h2_headers() {
TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST ",
));
}
future::ok::<_, ()>(config.body(data.clone()))
ok::<_, ()>(config.body(data.clone()))
})
.rustls(tls_config())
}).await;
@ -252,7 +252,7 @@ const STR: &str = "Hello World Hello World Hello World Hello World Hello World \
async fn test_h2_body2() {
let mut srv = test_server(move || {
HttpService::build()
.h2(|_| future::ok::<_, ()>(Response::Ok().body(STR)))
.h2(|_| ok::<_, ()>(Response::Ok().body(STR)))
.rustls(tls_config())
})
.await;