mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-24 22:37:35 +02:00
update actix-service dep
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
use std::io;
|
||||
|
||||
use actix_http_test::TestServer;
|
||||
use actix_service::{service_fn, ServiceFactory};
|
||||
use actix_service::{fn_service, ServiceFactory};
|
||||
|
||||
use bytes::{Bytes, BytesMut};
|
||||
use futures::future::{err, ok, ready};
|
||||
@ -361,7 +361,7 @@ async fn test_h2_body_chunked_explicit() {
|
||||
async fn test_h2_response_http_error_handling() {
|
||||
let mut srv = TestServer::start(move || {
|
||||
HttpService::build()
|
||||
.h2(service_fn(|_| {
|
||||
.h2(fn_service(|_| {
|
||||
let broken_header = Bytes::from_static(b"\0\0\0");
|
||||
ok::<_, ()>(
|
||||
Response::Ok()
|
||||
|
@ -4,7 +4,7 @@ use actix_http::http::header::{self, HeaderName, HeaderValue};
|
||||
use actix_http::http::{Method, StatusCode, Version};
|
||||
use actix_http::{body, error, Error, HttpService, Request, Response};
|
||||
use actix_http_test::TestServer;
|
||||
use actix_service::{factory_fn_cfg, service_fn2};
|
||||
use actix_service::{fn_factory_with_config, fn_service};
|
||||
|
||||
use bytes::{Bytes, BytesMut};
|
||||
use futures::future::{self, err, ok};
|
||||
@ -367,8 +367,8 @@ async fn test_h2_body_chunked_explicit() {
|
||||
async fn test_h2_response_http_error_handling() {
|
||||
let mut srv = TestServer::start(move || {
|
||||
HttpService::build()
|
||||
.h2(factory_fn_cfg(|_: ()| {
|
||||
ok::<_, ()>(service_fn2(|_| {
|
||||
.h2(fn_factory_with_config(|_: ()| {
|
||||
ok::<_, ()>(fn_service(|_| {
|
||||
let broken_header = Bytes::from_static(b"\0\0\0");
|
||||
ok::<_, ()>(
|
||||
Response::Ok()
|
||||
|
@ -4,7 +4,7 @@ use std::{net, thread};
|
||||
|
||||
use actix_http_test::TestServer;
|
||||
use actix_rt::time::delay_for;
|
||||
use actix_service::service_fn;
|
||||
use actix_service::fn_service;
|
||||
use bytes::Bytes;
|
||||
use futures::future::{self, err, ok, ready, FutureExt};
|
||||
use futures::stream::{once, StreamExt};
|
||||
@ -56,7 +56,7 @@ async fn test_h1_2() {
|
||||
async fn test_expect_continue() {
|
||||
let srv = TestServer::start(|| {
|
||||
HttpService::build()
|
||||
.expect(service_fn(|req: Request| {
|
||||
.expect(fn_service(|req: Request| {
|
||||
if req.head().uri.query() == Some("yes=") {
|
||||
ok(req)
|
||||
} else {
|
||||
@ -84,7 +84,7 @@ async fn test_expect_continue() {
|
||||
async fn test_expect_continue_h1() {
|
||||
let srv = TestServer::start(|| {
|
||||
HttpService::build()
|
||||
.expect(service_fn(|req: Request| {
|
||||
.expect(fn_service(|req: Request| {
|
||||
delay_for(Duration::from_millis(20)).then(move |_| {
|
||||
if req.head().uri.query() == Some("yes=") {
|
||||
ok(req)
|
||||
@ -93,7 +93,7 @@ async fn test_expect_continue_h1() {
|
||||
}
|
||||
})
|
||||
}))
|
||||
.h1(service_fn(|_| future::ok::<_, ()>(Response::Ok().finish())))
|
||||
.h1(fn_service(|_| future::ok::<_, ()>(Response::Ok().finish())))
|
||||
.tcp()
|
||||
});
|
||||
|
||||
@ -117,7 +117,7 @@ async fn test_chunked_payload() {
|
||||
|
||||
let srv = TestServer::start(|| {
|
||||
HttpService::build()
|
||||
.h1(service_fn(|mut request: Request| {
|
||||
.h1(fn_service(|mut request: Request| {
|
||||
request
|
||||
.take_payload()
|
||||
.map(|res| match res {
|
||||
@ -602,7 +602,7 @@ async fn test_h1_body_chunked_implicit() {
|
||||
async fn test_h1_response_http_error_handling() {
|
||||
let mut srv = TestServer::start(|| {
|
||||
HttpService::build()
|
||||
.h1(service_fn(|_| {
|
||||
.h1(fn_service(|_| {
|
||||
let broken_header = Bytes::from_static(b"\0\0\0");
|
||||
ok::<_, ()>(
|
||||
Response::Ok()
|
||||
|
@ -38,7 +38,7 @@ async fn service(msg: ws::Frame) -> Result<ws::Message, Error> {
|
||||
async fn test_simple() {
|
||||
let mut srv = TestServer::start(|| {
|
||||
HttpService::build()
|
||||
.upgrade(actix_service::service_fn(ws_service))
|
||||
.upgrade(actix_service::fn_service(ws_service))
|
||||
.finish(|_| future::ok::<_, ()>(Response::NotFound()))
|
||||
.tcp()
|
||||
});
|
||||
|
Reference in New Issue
Block a user