diff --git a/src/lib.rs b/src/lib.rs index d6bcf4e32..dbf8f7439 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -64,7 +64,7 @@ pub mod dev { pub use crate::types::readlines::Readlines; pub use actix_http::body::{Body, BodyLength, MessageBody, ResponseBody}; - pub use actix_http::dev::ResponseBuilder as HttpResponseBuilder; + pub use actix_http::ResponseBuilder as HttpResponseBuilder; pub use actix_http::{ Extensions, Payload, PayloadStream, RequestHead, ResponseHead, }; diff --git a/src/responder.rs b/src/responder.rs index ace360c62..5f98e6e83 100644 --- a/src/responder.rs +++ b/src/responder.rs @@ -1,5 +1,5 @@ use actix_http::error::InternalError; -use actix_http::{dev::ResponseBuilder, http::StatusCode, Error, Response}; +use actix_http::{http::StatusCode, Error, Response, ResponseBuilder}; use bytes::{Bytes, BytesMut}; use futures::future::{err, ok, Either as EitherFuture, FutureResult}; use futures::{Future, IntoFuture, Poll}; diff --git a/src/types/form.rs b/src/types/form.rs index 58fa37611..cd4d09bb5 100644 --- a/src/types/form.rs +++ b/src/types/form.rs @@ -3,7 +3,7 @@ use std::rc::Rc; use std::{fmt, ops}; -use actix_http::error::{Error, PayloadError, UrlencodedError}; +use actix_http::error::{Error, PayloadError}; use actix_http::{HttpMessage, Payload}; use bytes::{Bytes, BytesMut}; use encoding::all::UTF_8; @@ -12,6 +12,7 @@ use encoding::EncodingRef; use futures::{Future, Poll, Stream}; use serde::de::DeserializeOwned; +use crate::error::UrlencodedError; use crate::extract::FromRequest; use crate::http::header::CONTENT_LENGTH; use crate::request::HttpRequest; diff --git a/src/types/json.rs b/src/types/json.rs index 18a6be909..4fc2748f0 100644 --- a/src/types/json.rs +++ b/src/types/json.rs @@ -9,10 +9,10 @@ use serde::de::DeserializeOwned; use serde::Serialize; use serde_json; -use actix_http::error::{Error, JsonPayloadError, PayloadError}; use actix_http::http::{header::CONTENT_LENGTH, StatusCode}; use actix_http::{HttpMessage, Payload, Response}; +use crate::error::{Error, JsonPayloadError, PayloadError}; use crate::extract::FromRequest; use crate::request::HttpRequest; use crate::responder::Responder; diff --git a/src/types/readlines.rs b/src/types/readlines.rs index 2c7f699a7..c23b84434 100644 --- a/src/types/readlines.rs +++ b/src/types/readlines.rs @@ -198,7 +198,7 @@ mod tests { }; match block_on(stream.into_future()) { - Ok((Some(s), stream)) => { + Ok((Some(s), _)) => { assert_eq!( s, "Contrary to popular belief, Lorem Ipsum is not simply random text." diff --git a/tests/test_server.rs b/tests/test_server.rs index ffdc473a1..965d444fc 100644 --- a/tests/test_server.rs +++ b/tests/test_server.rs @@ -3,7 +3,7 @@ use std::io::{Read, Write}; use actix_http::http::header::{ ContentEncoding, ACCEPT_ENCODING, CONTENT_LENGTH, TRANSFER_ENCODING, }; -use actix_http::{h1, Error, HttpMessage, Response}; +use actix_http::{h1, Error, Response}; use actix_http_test::TestServer; use brotli2::write::BrotliDecoder; use bytes::Bytes; @@ -12,7 +12,7 @@ use flate2::write::ZlibDecoder; use futures::stream::once; //Future, Stream use rand::{distributions::Alphanumeric, Rng}; -use actix_web::{middleware, web, App}; +use actix_web::{dev::HttpMessageBody, middleware, web, App}; const STR: &str = "Hello World Hello World Hello World Hello World Hello World \ Hello World Hello World Hello World Hello World Hello World \ @@ -50,7 +50,7 @@ fn test_body() { assert!(response.status().is_success()); // read response - let bytes = srv.block_on(response.body()).unwrap(); + let bytes = srv.block_on(HttpMessageBody::new(&mut response)).unwrap(); assert_eq!(bytes, Bytes::from_static(STR.as_ref())); } @@ -69,7 +69,7 @@ fn test_body_gzip() { assert!(response.status().is_success()); // read response - let bytes = srv.block_on(response.body()).unwrap(); + let bytes = srv.block_on(HttpMessageBody::new(&mut response)).unwrap(); // decode let mut e = GzDecoder::new(&bytes[..]); @@ -100,7 +100,7 @@ fn test_body_gzip_large() { assert!(response.status().is_success()); // read response - let bytes = srv.block_on(response.body()).unwrap(); + let bytes = srv.block_on(HttpMessageBody::new(&mut response)).unwrap(); // decode let mut e = GzDecoder::new(&bytes[..]); @@ -134,7 +134,7 @@ fn test_body_gzip_large_random() { assert!(response.status().is_success()); // read response - let bytes = srv.block_on(response.body()).unwrap(); + let bytes = srv.block_on(HttpMessageBody::new(&mut response)).unwrap(); // decode let mut e = GzDecoder::new(&bytes[..]); @@ -167,7 +167,7 @@ fn test_body_chunked_implicit() { ); // read response - let bytes = srv.block_on(response.body()).unwrap(); + let bytes = srv.block_on(HttpMessageBody::new(&mut response)).unwrap(); // decode let mut e = GzDecoder::new(&bytes[..]); @@ -195,7 +195,7 @@ fn test_body_br_streaming() { assert!(response.status().is_success()); // read response - let bytes = srv.block_on(response.body()).unwrap(); + let bytes = srv.block_on(HttpMessageBody::new(&mut response)).unwrap(); // decode br let mut e = BrotliDecoder::new(Vec::with_capacity(2048)); @@ -222,7 +222,7 @@ fn test_head_binary() { } // read response - let bytes = srv.block_on(response.body()).unwrap(); + let bytes = srv.block_on(HttpMessageBody::new(&mut response)).unwrap(); assert!(bytes.is_empty()); } @@ -245,7 +245,7 @@ fn test_no_chunking() { assert!(!response.headers().contains_key(TRANSFER_ENCODING)); // read response - let bytes = srv.block_on(response.body()).unwrap(); + let bytes = srv.block_on(HttpMessageBody::new(&mut response)).unwrap(); assert_eq!(bytes, Bytes::from_static(STR.as_ref())); } @@ -267,7 +267,7 @@ fn test_body_deflate() { assert!(response.status().is_success()); // read response - let bytes = srv.block_on(response.body()).unwrap(); + let bytes = srv.block_on(HttpMessageBody::new(&mut response)).unwrap(); // decode deflate let mut e = ZlibDecoder::new(Vec::new()); @@ -294,7 +294,7 @@ fn test_body_brotli() { assert!(response.status().is_success()); // read response - let bytes = srv.block_on(response.body()).unwrap(); + let bytes = srv.block_on(HttpMessageBody::new(&mut response)).unwrap(); // decode brotli let mut e = BrotliDecoder::new(Vec::with_capacity(2048));