mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 07:53:00 +01:00
update imports
This commit is contained in:
parent
9012c46fe1
commit
b550f9ecf4
@ -64,7 +64,7 @@ pub mod dev {
|
|||||||
pub use crate::types::readlines::Readlines;
|
pub use crate::types::readlines::Readlines;
|
||||||
|
|
||||||
pub use actix_http::body::{Body, BodyLength, MessageBody, ResponseBody};
|
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::{
|
pub use actix_http::{
|
||||||
Extensions, Payload, PayloadStream, RequestHead, ResponseHead,
|
Extensions, Payload, PayloadStream, RequestHead, ResponseHead,
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use actix_http::error::InternalError;
|
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 bytes::{Bytes, BytesMut};
|
||||||
use futures::future::{err, ok, Either as EitherFuture, FutureResult};
|
use futures::future::{err, ok, Either as EitherFuture, FutureResult};
|
||||||
use futures::{Future, IntoFuture, Poll};
|
use futures::{Future, IntoFuture, Poll};
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::{fmt, ops};
|
use std::{fmt, ops};
|
||||||
|
|
||||||
use actix_http::error::{Error, PayloadError, UrlencodedError};
|
use actix_http::error::{Error, PayloadError};
|
||||||
use actix_http::{HttpMessage, Payload};
|
use actix_http::{HttpMessage, Payload};
|
||||||
use bytes::{Bytes, BytesMut};
|
use bytes::{Bytes, BytesMut};
|
||||||
use encoding::all::UTF_8;
|
use encoding::all::UTF_8;
|
||||||
@ -12,6 +12,7 @@ use encoding::EncodingRef;
|
|||||||
use futures::{Future, Poll, Stream};
|
use futures::{Future, Poll, Stream};
|
||||||
use serde::de::DeserializeOwned;
|
use serde::de::DeserializeOwned;
|
||||||
|
|
||||||
|
use crate::error::UrlencodedError;
|
||||||
use crate::extract::FromRequest;
|
use crate::extract::FromRequest;
|
||||||
use crate::http::header::CONTENT_LENGTH;
|
use crate::http::header::CONTENT_LENGTH;
|
||||||
use crate::request::HttpRequest;
|
use crate::request::HttpRequest;
|
||||||
|
@ -9,10 +9,10 @@ use serde::de::DeserializeOwned;
|
|||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use serde_json;
|
use serde_json;
|
||||||
|
|
||||||
use actix_http::error::{Error, JsonPayloadError, PayloadError};
|
|
||||||
use actix_http::http::{header::CONTENT_LENGTH, StatusCode};
|
use actix_http::http::{header::CONTENT_LENGTH, StatusCode};
|
||||||
use actix_http::{HttpMessage, Payload, Response};
|
use actix_http::{HttpMessage, Payload, Response};
|
||||||
|
|
||||||
|
use crate::error::{Error, JsonPayloadError, PayloadError};
|
||||||
use crate::extract::FromRequest;
|
use crate::extract::FromRequest;
|
||||||
use crate::request::HttpRequest;
|
use crate::request::HttpRequest;
|
||||||
use crate::responder::Responder;
|
use crate::responder::Responder;
|
||||||
|
@ -198,7 +198,7 @@ mod tests {
|
|||||||
};
|
};
|
||||||
|
|
||||||
match block_on(stream.into_future()) {
|
match block_on(stream.into_future()) {
|
||||||
Ok((Some(s), stream)) => {
|
Ok((Some(s), _)) => {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
s,
|
s,
|
||||||
"Contrary to popular belief, Lorem Ipsum is not simply random text."
|
"Contrary to popular belief, Lorem Ipsum is not simply random text."
|
||||||
|
@ -3,7 +3,7 @@ use std::io::{Read, Write};
|
|||||||
use actix_http::http::header::{
|
use actix_http::http::header::{
|
||||||
ContentEncoding, ACCEPT_ENCODING, CONTENT_LENGTH, TRANSFER_ENCODING,
|
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 actix_http_test::TestServer;
|
||||||
use brotli2::write::BrotliDecoder;
|
use brotli2::write::BrotliDecoder;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
@ -12,7 +12,7 @@ use flate2::write::ZlibDecoder;
|
|||||||
use futures::stream::once; //Future, Stream
|
use futures::stream::once; //Future, Stream
|
||||||
use rand::{distributions::Alphanumeric, Rng};
|
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 \
|
const STR: &str = "Hello World Hello World Hello World Hello World Hello World \
|
||||||
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());
|
assert!(response.status().is_success());
|
||||||
|
|
||||||
// read response
|
// 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()));
|
assert_eq!(bytes, Bytes::from_static(STR.as_ref()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ fn test_body_gzip() {
|
|||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
|
|
||||||
// read response
|
// read response
|
||||||
let bytes = srv.block_on(response.body()).unwrap();
|
let bytes = srv.block_on(HttpMessageBody::new(&mut response)).unwrap();
|
||||||
|
|
||||||
// decode
|
// decode
|
||||||
let mut e = GzDecoder::new(&bytes[..]);
|
let mut e = GzDecoder::new(&bytes[..]);
|
||||||
@ -100,7 +100,7 @@ fn test_body_gzip_large() {
|
|||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
|
|
||||||
// read response
|
// read response
|
||||||
let bytes = srv.block_on(response.body()).unwrap();
|
let bytes = srv.block_on(HttpMessageBody::new(&mut response)).unwrap();
|
||||||
|
|
||||||
// decode
|
// decode
|
||||||
let mut e = GzDecoder::new(&bytes[..]);
|
let mut e = GzDecoder::new(&bytes[..]);
|
||||||
@ -134,7 +134,7 @@ fn test_body_gzip_large_random() {
|
|||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
|
|
||||||
// read response
|
// read response
|
||||||
let bytes = srv.block_on(response.body()).unwrap();
|
let bytes = srv.block_on(HttpMessageBody::new(&mut response)).unwrap();
|
||||||
|
|
||||||
// decode
|
// decode
|
||||||
let mut e = GzDecoder::new(&bytes[..]);
|
let mut e = GzDecoder::new(&bytes[..]);
|
||||||
@ -167,7 +167,7 @@ fn test_body_chunked_implicit() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// read response
|
// read response
|
||||||
let bytes = srv.block_on(response.body()).unwrap();
|
let bytes = srv.block_on(HttpMessageBody::new(&mut response)).unwrap();
|
||||||
|
|
||||||
// decode
|
// decode
|
||||||
let mut e = GzDecoder::new(&bytes[..]);
|
let mut e = GzDecoder::new(&bytes[..]);
|
||||||
@ -195,7 +195,7 @@ fn test_body_br_streaming() {
|
|||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
|
|
||||||
// read response
|
// read response
|
||||||
let bytes = srv.block_on(response.body()).unwrap();
|
let bytes = srv.block_on(HttpMessageBody::new(&mut response)).unwrap();
|
||||||
|
|
||||||
// decode br
|
// decode br
|
||||||
let mut e = BrotliDecoder::new(Vec::with_capacity(2048));
|
let mut e = BrotliDecoder::new(Vec::with_capacity(2048));
|
||||||
@ -222,7 +222,7 @@ fn test_head_binary() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// read response
|
// read response
|
||||||
let bytes = srv.block_on(response.body()).unwrap();
|
let bytes = srv.block_on(HttpMessageBody::new(&mut response)).unwrap();
|
||||||
assert!(bytes.is_empty());
|
assert!(bytes.is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ fn test_no_chunking() {
|
|||||||
assert!(!response.headers().contains_key(TRANSFER_ENCODING));
|
assert!(!response.headers().contains_key(TRANSFER_ENCODING));
|
||||||
|
|
||||||
// read response
|
// 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()));
|
assert_eq!(bytes, Bytes::from_static(STR.as_ref()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ fn test_body_deflate() {
|
|||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
|
|
||||||
// read response
|
// read response
|
||||||
let bytes = srv.block_on(response.body()).unwrap();
|
let bytes = srv.block_on(HttpMessageBody::new(&mut response)).unwrap();
|
||||||
|
|
||||||
// decode deflate
|
// decode deflate
|
||||||
let mut e = ZlibDecoder::new(Vec::new());
|
let mut e = ZlibDecoder::new(Vec::new());
|
||||||
@ -294,7 +294,7 @@ fn test_body_brotli() {
|
|||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
|
|
||||||
// read response
|
// read response
|
||||||
let bytes = srv.block_on(response.body()).unwrap();
|
let bytes = srv.block_on(HttpMessageBody::new(&mut response)).unwrap();
|
||||||
|
|
||||||
// decode brotli
|
// decode brotli
|
||||||
let mut e = BrotliDecoder::new(Vec::with_capacity(2048));
|
let mut e = BrotliDecoder::new(Vec::with_capacity(2048));
|
||||||
|
Loading…
Reference in New Issue
Block a user