mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-26 15:07:42 +02:00
refactor http-test server
This commit is contained in:
@ -3,7 +3,7 @@ use bytes::Bytes;
|
||||
use futures::future::{self, ok};
|
||||
|
||||
use actix_http::{http, HttpService, Request, Response};
|
||||
use actix_http_test::TestServer;
|
||||
use actix_http_test::test_server;
|
||||
|
||||
const STR: &str = "Hello World Hello World Hello World Hello World Hello World \
|
||||
Hello World Hello World Hello World Hello World Hello World \
|
||||
@ -29,7 +29,7 @@ const STR: &str = "Hello World Hello World Hello World Hello World Hello World \
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn test_h1_v2() {
|
||||
let srv = TestServer::start(move || {
|
||||
let srv = test_server(move || {
|
||||
HttpService::build()
|
||||
.finish(|_| future::ok::<_, ()>(Response::Ok().body(STR)))
|
||||
.tcp()
|
||||
@ -56,7 +56,7 @@ async fn test_h1_v2() {
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn test_connection_close() {
|
||||
let srv = TestServer::start(move || {
|
||||
let srv = test_server(move || {
|
||||
HttpService::build()
|
||||
.finish(|_| ok::<_, ()>(Response::Ok().body(STR)))
|
||||
.tcp()
|
||||
@ -69,7 +69,7 @@ async fn test_connection_close() {
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn test_with_query_parameter() {
|
||||
let srv = TestServer::start(move || {
|
||||
let srv = test_server(move || {
|
||||
HttpService::build()
|
||||
.finish(|req: Request| {
|
||||
if req.uri().query().unwrap().contains("qp=") {
|
||||
|
Reference in New Issue
Block a user