1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-26 06:57:43 +02:00

remove actix_http::http module (#2488)

This commit is contained in:
Rob Ede
2021-12-05 14:37:20 +00:00
committed by GitHub
parent 59be0c65c6
commit 2d053b7036
57 changed files with 209 additions and 234 deletions

View File

@ -1,6 +1,10 @@
use std::{convert::TryFrom, fmt, net::IpAddr, rc::Rc, time::Duration};
use actix_http::http::{self, header, Error as HttpError, HeaderMap, HeaderName, Uri};
use actix_http::{
error::HttpError,
header::{self, HeaderMap, HeaderName},
Uri,
};
use actix_rt::net::{ActixStream, TcpStream};
use actix_service::{boxed, Service};

View File

@ -2,7 +2,7 @@ use std::{fmt, io};
use derive_more::{Display, From};
use actix_http::{error::ParseError, http::Error as HttpError};
use actix_http::error::{HttpError, ParseError};
#[cfg(feature = "openssl")]
use actix_tls::accept::openssl::reexports::Error as OpensslError;

View File

@ -9,11 +9,8 @@ use actix_http::{
body::{BodySize, MessageBody},
error::PayloadError,
h1,
http::{
header::{HeaderMap, IntoHeaderValue, EXPECT, HOST},
StatusCode,
},
Payload, RequestHeadType, ResponseHead,
header::{HeaderMap, IntoHeaderValue, EXPECT, HOST},
Payload, RequestHeadType, ResponseHead, StatusCode,
};
use actix_utils::future::poll_fn;
use bytes::buf::BufMut;

View File

@ -1,9 +1,10 @@
//! HTTP client errors
pub use actix_http::{
error::PayloadError,
http::{header::HeaderValue, Error as HttpError, StatusCode},
error::{HttpError, PayloadError},
header::HeaderValue,
ws::{HandshakeError as WsHandshakeError, ProtocolError as WsProtocolError},
StatusCode,
};
use derive_more::{Display, From};

View File

@ -5,8 +5,9 @@ use futures_core::Stream;
use serde::Serialize;
use actix_http::{
http::{header::IntoHeaderValue, Error as HttpError, HeaderMap, HeaderName, Method, Uri},
RequestHead,
error::HttpError,
header::{HeaderMap, HeaderName, IntoHeaderValue},
Method, RequestHead, Uri,
};
use crate::{

View File

@ -117,7 +117,8 @@ mod sender;
pub mod test;
pub mod ws;
pub use actix_http::http;
// TODO: hmmmmmm
pub use actix_http as http;
#[cfg(feature = "cookies")]
pub use cookie;
@ -131,10 +132,7 @@ pub use self::sender::SendClientRequest;
use std::{convert::TryFrom, rc::Rc, time::Duration};
use actix_http::{
http::{Error as HttpError, HeaderMap, Method, Uri},
RequestHead,
};
use actix_http::{error::HttpError, header::HeaderMap, Method, RequestHead, Uri};
use actix_rt::net::TcpStream;
use actix_service::Service;

View File

@ -7,10 +7,7 @@ use std::{
task::{Context, Poll},
};
use actix_http::{
http::{header, Method, StatusCode, Uri},
RequestHead, RequestHeadType,
};
use actix_http::{header, Method, RequestHead, RequestHeadType, StatusCode, Uri};
use actix_service::Service;
use bytes::Bytes;
use futures_core::ready;
@ -284,12 +281,12 @@ fn remove_sensitive_headers(headers: &mut header::HeaderMap, prev_uri: &Uri, nex
#[cfg(test)]
mod tests {
use std::str::FromStr;
use actix_web::{web, App, Error, HttpRequest, HttpResponse};
use super::*;
use crate::http::HeaderValue;
use crate::ClientBuilder;
use std::str::FromStr;
use crate::{http::header::HeaderValue, ClientBuilder};
#[actix_rt::test]
async fn test_basic_redirect() {

View File

@ -5,11 +5,9 @@ use futures_core::Stream;
use serde::Serialize;
use actix_http::{
http::{
header::{self, IntoHeaderPair},
ConnectionType, Error as HttpError, HeaderMap, HeaderValue, Method, Uri, Version,
},
RequestHead,
error::HttpError,
header::{self, HeaderMap, HeaderValue, IntoHeaderPair},
ConnectionType, Method, RequestHead, Uri, Version,
};
use crate::{
@ -539,7 +537,7 @@ impl fmt::Debug for ClientRequest {
mod tests {
use std::time::SystemTime;
use actix_http::http::header::HttpDate;
use actix_http::header::HttpDate;
use super::*;
use crate::Client;

View File

@ -10,9 +10,8 @@ use std::{
};
use actix_http::{
error::PayloadError,
http::{header, HeaderMap, StatusCode, Version},
Extensions, HttpMessage, Payload, PayloadStream, ResponseHead,
error::PayloadError, header, header::HeaderMap, Extensions, HttpMessage, Payload,
PayloadStream, ResponseHead, StatusCode, Version,
};
use actix_rt::time::{sleep, Sleep};
use bytes::{Bytes, BytesMut};

View File

@ -9,10 +9,8 @@ use std::{
use actix_http::{
body::BodyStream,
http::{
header::{self, HeaderMap, HeaderName, IntoHeaderValue},
Error as HttpError,
},
error::HttpError,
header::{self, HeaderMap, HeaderName, IntoHeaderValue},
RequestHead, RequestHeadType,
};
use actix_rt::time::{sleep, Sleep};
@ -22,7 +20,7 @@ use futures_core::Stream;
use serde::Serialize;
#[cfg(feature = "__compress")]
use actix_http::{encoding::Decoder, http::header::ContentEncoding, Payload, PayloadStream};
use actix_http::{encoding::Decoder, header::ContentEncoding, Payload, PayloadStream};
use crate::{
any_body::AnyBody,

View File

@ -1,7 +1,6 @@
//! Test helpers for actix http client to use during testing.
use actix_http::http::header::IntoHeaderPair;
use actix_http::http::{StatusCode, Version};
use actix_http::{h1, Payload, ResponseHead};
use actix_http::{h1, header::IntoHeaderPair, Payload, ResponseHead, StatusCode, Version};
use bytes::Bytes;
#[cfg(feature = "cookies")]
@ -89,7 +88,7 @@ impl TestResponse {
#[cfg(feature = "cookies")]
for cookie in self.cookies.delta() {
use actix_http::http::header::{self, HeaderValue};
use actix_http::header::{self, HeaderValue};
head.headers.insert(
header::SET_COOKIE,
@ -109,7 +108,7 @@ impl TestResponse {
mod tests {
use std::time::SystemTime;
use actix_http::http::header::HttpDate;
use actix_http::header::HttpDate;
use super::*;
use crate::{cookie, http::header};

View File

@ -26,9 +26,7 @@
//! }
//! ```
use std::convert::TryFrom;
use std::net::SocketAddr;
use std::{fmt, str};
use std::{convert::TryFrom, fmt, net::SocketAddr, str};
use actix_codec::Framed;
use actix_http::{ws, Payload, RequestHead};
@ -37,14 +35,19 @@ use actix_service::Service;
pub use actix_http::ws::{CloseCode, CloseReason, Codec, Frame, Message};
use crate::connect::{BoxedSocket, ConnectRequest};
use crate::{
connect::{BoxedSocket, ConnectRequest},
error::{HttpError, InvalidUrl, SendRequestError, WsClientError},
http::{
header::{self, HeaderName, HeaderValue, IntoHeaderValue, AUTHORIZATION},
ConnectionType, Method, StatusCode, Uri, Version,
},
response::ClientResponse,
ClientConfig,
};
#[cfg(feature = "cookies")]
use crate::cookie::{Cookie, CookieJar};
use crate::error::{InvalidUrl, SendRequestError, WsClientError};
use crate::http::header::{self, HeaderName, HeaderValue, IntoHeaderValue, AUTHORIZATION};
use crate::http::{ConnectionType, Error as HttpError, Method, StatusCode, Uri, Version};
use crate::response::ClientResponse;
use crate::ClientConfig;
/// WebSocket connection.
pub struct WebsocketsRequest {

View File

@ -21,10 +21,7 @@ use brotli2::write::BrotliEncoder;
#[cfg(feature = "compress-gzip")]
use flate2::{read::GzDecoder, write::GzEncoder, Compression};
use actix_http::{
http::{self, StatusCode},
HttpService,
};
use actix_http::{ContentEncoding, HttpService, StatusCode};
use actix_http_test::test_server;
use actix_service::{fn_service, map_config, ServiceFactoryExt as _};
use actix_web::{
@ -647,9 +644,7 @@ async fn test_client_brotli_encoding_large_random() {
async fn test_client_deflate_encoding() {
let srv = actix_test::start(|| {
App::new().default_service(web::to(|body: Bytes| {
HttpResponse::Ok()
.encoding(http::ContentEncoding::Br)
.body(body)
HttpResponse::Ok().encoding(ContentEncoding::Br).body(body)
}))
});
@ -672,9 +667,7 @@ async fn test_client_deflate_encoding_large_random() {
let srv = actix_test::start(|| {
App::new().default_service(web::to(|body: Bytes| {
HttpResponse::Ok()
.encoding(http::ContentEncoding::Br)
.body(body)
HttpResponse::Ok().encoding(ContentEncoding::Br).body(body)
}))
});
@ -692,7 +685,7 @@ async fn test_client_streaming_explicit() {
let srv = actix_test::start(|| {
App::new().default_service(web::to(|body: web::Payload| {
HttpResponse::Ok()
.encoding(http::ContentEncoding::Identity)
.encoding(ContentEncoding::Identity)
.streaming(body)
}))
});
@ -717,7 +710,7 @@ async fn test_body_streaming_implicit() {
});
HttpResponse::Ok()
.encoding(http::ContentEncoding::Gzip)
.encoding(ContentEncoding::Gzip)
.streaming(Box::pin(body))
}))
});