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

unify requedt/response encoder

This commit is contained in:
Nikolay Kim
2018-11-19 14:57:12 -08:00
parent 1ca6b44bae
commit 3901239128
12 changed files with 448 additions and 405 deletions

View File

@ -89,7 +89,9 @@ fn test_content_length() {
{
for i in 0..4 {
let req = client::ClientRequest::get(srv.url("/")).finish().unwrap();
let req = client::ClientRequest::get(srv.url(&format!("/{}", i)))
.finish()
.unwrap();
let response = srv.send_request(req).unwrap();
assert_eq!(response.headers().get(&header), None);

View File

@ -13,7 +13,7 @@ use actix_net::service::NewServiceExt;
use actix_net::stream::TakeItem;
use actix_web::ws as web_ws;
use bytes::{Bytes, BytesMut};
use futures::future::{ok, Either};
use futures::future::{lazy, ok, Either};
use futures::{Future, Sink, Stream};
use actix_http::{h1, test, ws, ResponseError, SendResponse, ServiceConfig};
@ -81,8 +81,9 @@ fn test_simple() {
{
let url = srv.url("/");
let (reader, mut writer) =
srv.block_on(web_ws::Client::new(url).connect()).unwrap();
let (reader, mut writer) = srv
.block_on(lazy(|| web_ws::Client::new(url).connect()))
.unwrap();
writer.text("text");
let (item, reader) = srv.block_on(reader.into_future()).unwrap();