mirror of
https://github.com/actix/actix-web.git
synced 2024-11-22 17:41:11 +00:00
drop deprecated code
This commit is contained in:
parent
ae6c9cb7fa
commit
f5636f321b
18 changed files with 61 additions and 152 deletions
|
@ -1,6 +1,6 @@
|
|||
# Changes
|
||||
|
||||
## 0.4.11
|
||||
## 0.5.0
|
||||
|
||||
* Type-safe path/query parameter handling, using serde #70
|
||||
|
||||
|
|
|
@ -172,12 +172,11 @@ and is on for *HTTP/1.1* and *HTTP/2.0*.
|
|||
|
||||
```rust
|
||||
# extern crate actix_web;
|
||||
# use actix_web::httpcodes::*;
|
||||
use actix_web::*;
|
||||
use actix_web::{header, HttpRequest, HttpResponse, httpcodes::HttpOk};
|
||||
|
||||
fn index(req: HttpRequest) -> HttpResponse {
|
||||
HttpOk.build()
|
||||
.connection_type(headers::ConnectionType::Close) // <- Close connection
|
||||
.connection_type(header::ConnectionType::Close) // <- Close connection
|
||||
.force_close() // <- Alternative method
|
||||
.finish().unwrap()
|
||||
}
|
||||
|
|
|
@ -12,8 +12,7 @@ builder instance multiple times, the builder will panic.
|
|||
|
||||
```rust
|
||||
# extern crate actix_web;
|
||||
use actix_web::*;
|
||||
use actix_web::headers::ContentEncoding;
|
||||
use actix_web::{HttpRequest, HttpResponse, header::ContentEncoding};
|
||||
|
||||
fn index(req: HttpRequest) -> HttpResponse {
|
||||
HttpResponse::Ok()
|
||||
|
@ -46,8 +45,7 @@ to enable `brotli` use `ContentEncoding::Br`:
|
|||
|
||||
```rust
|
||||
# extern crate actix_web;
|
||||
use actix_web::*;
|
||||
use actix_web::headers::ContentEncoding;
|
||||
use actix_web::{HttpRequest, HttpResponse, header::ContentEncoding};
|
||||
|
||||
fn index(req: HttpRequest) -> HttpResponse {
|
||||
HttpResponse::Ok()
|
||||
|
|
|
@ -6,7 +6,7 @@ use std::collections::HashMap;
|
|||
use handler::Reply;
|
||||
use router::{Router, Pattern};
|
||||
use resource::Resource;
|
||||
use headers::ContentEncoding;
|
||||
use header::ContentEncoding;
|
||||
use handler::{Handler, RouteHandler, WrapHandler};
|
||||
use httprequest::HttpRequest;
|
||||
use pipeline::{Pipeline, PipelineHandler};
|
||||
|
|
|
@ -11,7 +11,7 @@ use actix::prelude::*;
|
|||
use error::Error;
|
||||
use body::{Body, BodyStream};
|
||||
use context::{Frame, ActorHttpContext};
|
||||
use headers::ContentEncoding;
|
||||
use header::ContentEncoding;
|
||||
use httpmessage::HttpMessage;
|
||||
use error::PayloadError;
|
||||
use server::WriterState;
|
||||
|
|
|
@ -449,7 +449,7 @@ impl ClientRequestBuilder {
|
|||
/// # use actix_web::*;
|
||||
/// # use actix_web::httpcodes::*;
|
||||
/// #
|
||||
/// use actix_web::headers::Cookie;
|
||||
/// use actix_web::header::Cookie;
|
||||
/// use actix_web::client::ClientRequest;
|
||||
///
|
||||
/// fn main() {
|
||||
|
|
|
@ -421,7 +421,7 @@ impl HttpResponseBuilder {
|
|||
/// # use actix_web::*;
|
||||
/// # use actix_web::httpcodes::*;
|
||||
/// #
|
||||
/// use actix_web::headers::Cookie;
|
||||
/// use actix_web::header::Cookie;
|
||||
///
|
||||
/// fn index(req: HttpRequest) -> Result<HttpResponse> {
|
||||
/// Ok(HttpOk.build()
|
||||
|
|
12
src/lib.rs
12
src/lib.rs
|
@ -139,7 +139,7 @@ pub use application::Application;
|
|||
pub use httpmessage::HttpMessage;
|
||||
pub use httprequest::HttpRequest;
|
||||
pub use httpresponse::HttpResponse;
|
||||
pub use handler::{Either, Responder, NormalizePath, AsyncResponder, FutureResponse};
|
||||
pub use handler::{Either, Responder, AsyncResponder, FutureResponse};
|
||||
pub use context::HttpContext;
|
||||
pub use server::HttpServer;
|
||||
pub use extractor::{Path, Query};
|
||||
|
@ -157,16 +157,6 @@ pub(crate) const HAS_TLS: bool = true;
|
|||
#[cfg(not(feature="tls"))]
|
||||
pub(crate) const HAS_TLS: bool = false;
|
||||
|
||||
#[doc(hidden)]
|
||||
#[deprecated(since="0.4.4", note="please use `actix::header` module")]
|
||||
pub mod headers {
|
||||
//! Headers implementation
|
||||
pub use httpresponse::ConnectionType;
|
||||
pub use cookie::{Cookie, CookieBuilder};
|
||||
pub use http_range::HttpRange;
|
||||
pub use header::ContentEncoding;
|
||||
}
|
||||
|
||||
pub mod helpers {
|
||||
//! Various helpers
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use futures::unsync::oneshot;
|
|||
use body::{Body, BodyStream};
|
||||
use context::{Frame, ActorHttpContext};
|
||||
use error::Error;
|
||||
use headers::ContentEncoding;
|
||||
use header::ContentEncoding;
|
||||
use handler::{Reply, ReplyItem};
|
||||
use httprequest::HttpRequest;
|
||||
use httpresponse::HttpResponse;
|
||||
|
|
|
@ -79,12 +79,6 @@ impl<S: 'static> Route<S> {
|
|||
self
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[deprecated(since="0.4.1", note="please use `.filter()` instead")]
|
||||
pub fn p<T: Predicate<S> + 'static>(&mut self, p: T) -> &mut Self {
|
||||
self.filter(p)
|
||||
}
|
||||
|
||||
/// Set handler object. Usually call to this method is last call
|
||||
/// during route configuration, so it does not return reference to self.
|
||||
pub fn h<H: Handler<S>>(&mut self, handler: H) {
|
||||
|
|
|
@ -9,7 +9,7 @@ use http::{Method, Version};
|
|||
use http::header::{HeaderValue, CONNECTION, CONTENT_LENGTH, DATE};
|
||||
|
||||
use body::{Body, Binary};
|
||||
use headers::ContentEncoding;
|
||||
use header::ContentEncoding;
|
||||
use httprequest::HttpInnerMessage;
|
||||
use httpresponse::HttpResponse;
|
||||
use super::helpers;
|
||||
|
|
|
@ -10,7 +10,7 @@ use http::{Version, HttpTryFrom, Response};
|
|||
use http::header::{HeaderValue, CONNECTION, TRANSFER_ENCODING, DATE, CONTENT_LENGTH};
|
||||
|
||||
use body::{Body, Binary};
|
||||
use headers::ContentEncoding;
|
||||
use header::ContentEncoding;
|
||||
use httprequest::HttpInnerMessage;
|
||||
use httpresponse::HttpResponse;
|
||||
use super::helpers;
|
||||
|
|
|
@ -25,7 +25,7 @@ pub use self::settings::ServerSettings;
|
|||
|
||||
use body::Binary;
|
||||
use error::Error;
|
||||
use headers::ContentEncoding;
|
||||
use header::ContentEncoding;
|
||||
use httprequest::{HttpInnerMessage, HttpRequest};
|
||||
use httpresponse::HttpResponse;
|
||||
|
||||
|
|
42
src/test.rs
42
src/test.rs
|
@ -133,48 +133,6 @@ impl TestServer {
|
|||
}
|
||||
}
|
||||
|
||||
#[deprecated(since="0.4.10",
|
||||
note="please use `TestServer::build_with_state()` instead")]
|
||||
/// Start new test server with custom application state
|
||||
///
|
||||
/// This method accepts state factory and configuration method.
|
||||
pub fn with_state<S, FS, F>(state: FS, config: F) -> Self
|
||||
where S: 'static,
|
||||
FS: Sync + Send + 'static + Fn() -> S,
|
||||
F: Sync + Send + 'static + Fn(&mut TestApp<S>),
|
||||
{
|
||||
let (tx, rx) = mpsc::channel();
|
||||
|
||||
// run server in separate thread
|
||||
let join = thread::spawn(move || {
|
||||
let sys = System::new("actix-test-server");
|
||||
|
||||
let tcp = net::TcpListener::bind("127.0.0.1:0").unwrap();
|
||||
let local_addr = tcp.local_addr().unwrap();
|
||||
let tcp = TcpListener::from_listener(tcp, &local_addr, Arbiter::handle()).unwrap();
|
||||
|
||||
HttpServer::new(move || {
|
||||
let mut app = TestApp::new(state());
|
||||
config(&mut app);
|
||||
vec![app]}
|
||||
).disable_signals().start_incoming(tcp.incoming(), false);
|
||||
|
||||
tx.send((Arbiter::system(), local_addr)).unwrap();
|
||||
let _ = sys.run();
|
||||
});
|
||||
|
||||
let system = System::new("actix-test");
|
||||
let (server_sys, addr) = rx.recv().unwrap();
|
||||
TestServer {
|
||||
addr,
|
||||
server_sys,
|
||||
system,
|
||||
ssl: false,
|
||||
conn: TestServer::get_conn(),
|
||||
thread: Some(join),
|
||||
}
|
||||
}
|
||||
|
||||
fn get_conn() -> Addr<Unsync, ClientConnector> {
|
||||
#[cfg(feature="alpn")]
|
||||
{
|
||||
|
|
|
@ -32,24 +32,6 @@ use super::frame::Frame;
|
|||
use super::proto::{CloseCode, OpCode};
|
||||
|
||||
|
||||
/// Backward compatibility
|
||||
#[doc(hidden)]
|
||||
#[deprecated(since="0.4.2", note="please use `ws::Client` instead")]
|
||||
pub type WsClient = Client;
|
||||
#[doc(hidden)]
|
||||
#[deprecated(since="0.4.2", note="please use `ws::ClientError` instead")]
|
||||
pub type WsClientError = ClientError;
|
||||
#[doc(hidden)]
|
||||
#[deprecated(since="0.4.2", note="please use `ws::ClientReader` instead")]
|
||||
pub type WsClientReader = ClientReader;
|
||||
#[doc(hidden)]
|
||||
#[deprecated(since="0.4.2", note="please use `ws::ClientWriter` instead")]
|
||||
pub type WsClientWriter = ClientWriter;
|
||||
#[doc(hidden)]
|
||||
#[deprecated(since="0.4.2", note="please use `ws::ClientHandshake` instead")]
|
||||
pub type WsClientHandshake = ClientHandshake;
|
||||
|
||||
|
||||
/// Websocket client error
|
||||
#[derive(Fail, Debug)]
|
||||
pub enum ClientError {
|
||||
|
|
|
@ -70,18 +70,6 @@ pub use self::context::WebsocketContext;
|
|||
pub use self::client::{Client, ClientError,
|
||||
ClientReader, ClientWriter, ClientHandshake};
|
||||
|
||||
#[allow(deprecated)]
|
||||
pub use self::client::{WsClient, WsClientError,
|
||||
WsClientReader, WsClientWriter, WsClientHandshake};
|
||||
|
||||
/// Backward compatibility
|
||||
#[doc(hidden)]
|
||||
#[deprecated(since="0.4.2", note="please use `ws::ProtocolError` instead")]
|
||||
pub type WsError = ProtocolError;
|
||||
#[doc(hidden)]
|
||||
#[deprecated(since="0.4.2", note="please use `ws::HandshakeError` instead")]
|
||||
pub type WsHandshakeError = HandshakeError;
|
||||
|
||||
/// Websocket protocol errors
|
||||
#[derive(Fail, Debug)]
|
||||
pub enum ProtocolError {
|
||||
|
|
|
@ -116,14 +116,14 @@ fn test_client_gzip_encoding() {
|
|||
.and_then(|bytes: Bytes| {
|
||||
Ok(httpcodes::HTTPOk
|
||||
.build()
|
||||
.content_encoding(headers::ContentEncoding::Deflate)
|
||||
.content_encoding(header::ContentEncoding::Deflate)
|
||||
.body(bytes))
|
||||
}).responder()}
|
||||
));
|
||||
|
||||
// client request
|
||||
let request = srv.post()
|
||||
.content_encoding(headers::ContentEncoding::Gzip)
|
||||
.content_encoding(header::ContentEncoding::Gzip)
|
||||
.body(STR).unwrap();
|
||||
let response = srv.execute(request.send()).unwrap();
|
||||
assert!(response.status().is_success());
|
||||
|
@ -142,14 +142,14 @@ fn test_client_gzip_encoding_large() {
|
|||
.and_then(|bytes: Bytes| {
|
||||
Ok(httpcodes::HTTPOk
|
||||
.build()
|
||||
.content_encoding(headers::ContentEncoding::Deflate)
|
||||
.content_encoding(header::ContentEncoding::Deflate)
|
||||
.body(bytes))
|
||||
}).responder()}
|
||||
));
|
||||
|
||||
// client request
|
||||
let request = srv.post()
|
||||
.content_encoding(headers::ContentEncoding::Gzip)
|
||||
.content_encoding(header::ContentEncoding::Gzip)
|
||||
.body(data.clone()).unwrap();
|
||||
let response = srv.execute(request.send()).unwrap();
|
||||
assert!(response.status().is_success());
|
||||
|
@ -171,14 +171,14 @@ fn test_client_gzip_encoding_large_random() {
|
|||
.and_then(|bytes: Bytes| {
|
||||
Ok(httpcodes::HTTPOk
|
||||
.build()
|
||||
.content_encoding(headers::ContentEncoding::Deflate)
|
||||
.content_encoding(header::ContentEncoding::Deflate)
|
||||
.body(bytes))
|
||||
}).responder()}
|
||||
));
|
||||
|
||||
// client request
|
||||
let request = srv.post()
|
||||
.content_encoding(headers::ContentEncoding::Gzip)
|
||||
.content_encoding(header::ContentEncoding::Gzip)
|
||||
.body(data.clone()).unwrap();
|
||||
let response = srv.execute(request.send()).unwrap();
|
||||
assert!(response.status().is_success());
|
||||
|
@ -196,14 +196,14 @@ fn test_client_brotli_encoding() {
|
|||
.and_then(|bytes: Bytes| {
|
||||
Ok(httpcodes::HTTPOk
|
||||
.build()
|
||||
.content_encoding(headers::ContentEncoding::Gzip)
|
||||
.content_encoding(header::ContentEncoding::Gzip)
|
||||
.body(bytes))
|
||||
}).responder()}
|
||||
));
|
||||
|
||||
// client request
|
||||
let request = srv.client(Method::POST, "/")
|
||||
.content_encoding(headers::ContentEncoding::Br)
|
||||
.content_encoding(header::ContentEncoding::Br)
|
||||
.body(STR).unwrap();
|
||||
let response = srv.execute(request.send()).unwrap();
|
||||
assert!(response.status().is_success());
|
||||
|
@ -226,14 +226,14 @@ fn test_client_brotli_encoding_large_random() {
|
|||
.and_then(move |bytes: Bytes| {
|
||||
Ok(httpcodes::HTTPOk
|
||||
.build()
|
||||
.content_encoding(headers::ContentEncoding::Gzip)
|
||||
.content_encoding(header::ContentEncoding::Gzip)
|
||||
.body(bytes))
|
||||
}).responder()}
|
||||
));
|
||||
|
||||
// client request
|
||||
let request = srv.client(Method::POST, "/")
|
||||
.content_encoding(headers::ContentEncoding::Br)
|
||||
.content_encoding(header::ContentEncoding::Br)
|
||||
.body(data.clone()).unwrap();
|
||||
let response = srv.execute(request.send()).unwrap();
|
||||
assert!(response.status().is_success());
|
||||
|
@ -252,14 +252,14 @@ fn test_client_deflate_encoding() {
|
|||
.and_then(|bytes: Bytes| {
|
||||
Ok(httpcodes::HTTPOk
|
||||
.build()
|
||||
.content_encoding(headers::ContentEncoding::Br)
|
||||
.content_encoding(header::ContentEncoding::Br)
|
||||
.body(bytes))
|
||||
}).responder()}
|
||||
));
|
||||
|
||||
// client request
|
||||
let request = srv.post()
|
||||
.content_encoding(headers::ContentEncoding::Deflate)
|
||||
.content_encoding(header::ContentEncoding::Deflate)
|
||||
.body(STR).unwrap();
|
||||
let response = srv.execute(request.send()).unwrap();
|
||||
assert!(response.status().is_success());
|
||||
|
@ -282,14 +282,14 @@ fn test_client_deflate_encoding_large_random() {
|
|||
.and_then(|bytes: Bytes| {
|
||||
Ok(httpcodes::HTTPOk
|
||||
.build()
|
||||
.content_encoding(headers::ContentEncoding::Br)
|
||||
.content_encoding(header::ContentEncoding::Br)
|
||||
.body(bytes))
|
||||
}).responder()}
|
||||
));
|
||||
|
||||
// client request
|
||||
let request = srv.post()
|
||||
.content_encoding(headers::ContentEncoding::Deflate)
|
||||
.content_encoding(header::ContentEncoding::Deflate)
|
||||
.body(data.clone()).unwrap();
|
||||
let response = srv.execute(request.send()).unwrap();
|
||||
assert!(response.status().is_success());
|
||||
|
@ -308,7 +308,7 @@ fn test_client_streaming_explicit() {
|
|||
.and_then(|body| {
|
||||
Ok(httpcodes::HTTPOk.build()
|
||||
.chunked()
|
||||
.content_encoding(headers::ContentEncoding::Identity)
|
||||
.content_encoding(header::ContentEncoding::Identity)
|
||||
.body(body)?)})
|
||||
.responder()));
|
||||
|
||||
|
@ -329,7 +329,7 @@ fn test_body_streaming_implicit() {
|
|||
|app| app.handler(|_| {
|
||||
let body = once(Ok(Bytes::from_static(STR.as_ref())));
|
||||
httpcodes::HTTPOk.build()
|
||||
.content_encoding(headers::ContentEncoding::Gzip)
|
||||
.content_encoding(header::ContentEncoding::Gzip)
|
||||
.body(Body::Streaming(Box::new(body)))}));
|
||||
|
||||
let request = srv.get().finish().unwrap();
|
||||
|
|
|
@ -24,7 +24,7 @@ use futures::{Future, Stream};
|
|||
use futures::stream::once;
|
||||
use h2::client as h2client;
|
||||
use bytes::{Bytes, BytesMut};
|
||||
use http::{header, Request};
|
||||
use http::Request;
|
||||
use tokio_core::net::TcpStream;
|
||||
use tokio_core::reactor::Core;
|
||||
use rand::Rng;
|
||||
|
@ -196,7 +196,7 @@ fn test_body_gzip() {
|
|||
let mut srv = test::TestServer::new(
|
||||
|app| app.handler(
|
||||
|_| httpcodes::HTTPOk.build()
|
||||
.content_encoding(headers::ContentEncoding::Gzip)
|
||||
.content_encoding(header::ContentEncoding::Gzip)
|
||||
.body(STR)));
|
||||
|
||||
let request = srv.get().disable_decompress().finish().unwrap();
|
||||
|
@ -223,7 +223,7 @@ fn test_body_gzip_large() {
|
|||
let data = srv_data.clone();
|
||||
app.handler(
|
||||
move |_| httpcodes::HTTPOk.build()
|
||||
.content_encoding(headers::ContentEncoding::Gzip)
|
||||
.content_encoding(header::ContentEncoding::Gzip)
|
||||
.body(data.as_ref()))});
|
||||
|
||||
let request = srv.get().disable_decompress().finish().unwrap();
|
||||
|
@ -253,7 +253,7 @@ fn test_body_gzip_large_random() {
|
|||
let data = srv_data.clone();
|
||||
app.handler(
|
||||
move |_| httpcodes::HTTPOk.build()
|
||||
.content_encoding(headers::ContentEncoding::Gzip)
|
||||
.content_encoding(header::ContentEncoding::Gzip)
|
||||
.body(data.as_ref()))});
|
||||
|
||||
let request = srv.get().disable_decompress().finish().unwrap();
|
||||
|
@ -277,7 +277,7 @@ fn test_body_chunked_implicit() {
|
|||
|app| app.handler(|_| {
|
||||
let body = once(Ok(Bytes::from_static(STR.as_ref())));
|
||||
httpcodes::HTTPOk.build()
|
||||
.content_encoding(headers::ContentEncoding::Gzip)
|
||||
.content_encoding(header::ContentEncoding::Gzip)
|
||||
.body(Body::Streaming(Box::new(body)))}));
|
||||
|
||||
let request = srv.get().disable_decompress().finish().unwrap();
|
||||
|
@ -301,7 +301,7 @@ fn test_body_br_streaming() {
|
|||
|app| app.handler(|_| {
|
||||
let body = once(Ok(Bytes::from_static(STR.as_ref())));
|
||||
httpcodes::HTTPOk.build()
|
||||
.content_encoding(headers::ContentEncoding::Br)
|
||||
.content_encoding(header::ContentEncoding::Br)
|
||||
.body(Body::Streaming(Box::new(body)))}));
|
||||
|
||||
let request = srv.get().disable_decompress().finish().unwrap();
|
||||
|
@ -330,7 +330,7 @@ fn test_head_empty() {
|
|||
assert!(response.status().is_success());
|
||||
|
||||
{
|
||||
let len = response.headers().get(header::CONTENT_LENGTH).unwrap();
|
||||
let len = response.headers().get(header::http::CONTENT_LENGTH).unwrap();
|
||||
assert_eq!(format!("{}", STR.len()), len.to_str().unwrap());
|
||||
}
|
||||
|
||||
|
@ -344,7 +344,7 @@ fn test_head_binary() {
|
|||
let mut srv = test::TestServer::new(
|
||||
|app| app.handler(|_| {
|
||||
httpcodes::HTTPOk.build()
|
||||
.content_encoding(headers::ContentEncoding::Identity)
|
||||
.content_encoding(header::ContentEncoding::Identity)
|
||||
.content_length(100).body(STR)}));
|
||||
|
||||
let request = srv.head().finish().unwrap();
|
||||
|
@ -352,7 +352,7 @@ fn test_head_binary() {
|
|||
assert!(response.status().is_success());
|
||||
|
||||
{
|
||||
let len = response.headers().get(header::CONTENT_LENGTH).unwrap();
|
||||
let len = response.headers().get(header::http::CONTENT_LENGTH).unwrap();
|
||||
assert_eq!(format!("{}", STR.len()), len.to_str().unwrap());
|
||||
}
|
||||
|
||||
|
@ -366,7 +366,7 @@ fn test_head_binary2() {
|
|||
let mut srv = test::TestServer::new(
|
||||
|app| app.handler(|_| {
|
||||
httpcodes::HTTPOk.build()
|
||||
.content_encoding(headers::ContentEncoding::Identity)
|
||||
.content_encoding(header::ContentEncoding::Identity)
|
||||
.body(STR)
|
||||
}));
|
||||
|
||||
|
@ -375,7 +375,7 @@ fn test_head_binary2() {
|
|||
assert!(response.status().is_success());
|
||||
|
||||
{
|
||||
let len = response.headers().get(header::CONTENT_LENGTH).unwrap();
|
||||
let len = response.headers().get(header::http::CONTENT_LENGTH).unwrap();
|
||||
assert_eq!(format!("{}", STR.len()), len.to_str().unwrap());
|
||||
}
|
||||
}
|
||||
|
@ -387,7 +387,7 @@ fn test_body_length() {
|
|||
let body = once(Ok(Bytes::from_static(STR.as_ref())));
|
||||
httpcodes::HTTPOk.build()
|
||||
.content_length(STR.len() as u64)
|
||||
.content_encoding(headers::ContentEncoding::Identity)
|
||||
.content_encoding(header::ContentEncoding::Identity)
|
||||
.body(Body::Streaming(Box::new(body)))}));
|
||||
|
||||
let request = srv.get().finish().unwrap();
|
||||
|
@ -406,7 +406,7 @@ fn test_body_chunked_explicit() {
|
|||
let body = once(Ok(Bytes::from_static(STR.as_ref())));
|
||||
httpcodes::HTTPOk.build()
|
||||
.chunked()
|
||||
.content_encoding(headers::ContentEncoding::Gzip)
|
||||
.content_encoding(header::ContentEncoding::Gzip)
|
||||
.body(Body::Streaming(Box::new(body)))}));
|
||||
|
||||
let request = srv.get().disable_decompress().finish().unwrap();
|
||||
|
@ -429,7 +429,7 @@ fn test_body_deflate() {
|
|||
|app| app.handler(
|
||||
|_| httpcodes::HTTPOk
|
||||
.build()
|
||||
.content_encoding(headers::ContentEncoding::Deflate)
|
||||
.content_encoding(header::ContentEncoding::Deflate)
|
||||
.body(STR)));
|
||||
|
||||
// client request
|
||||
|
@ -454,7 +454,7 @@ fn test_body_brotli() {
|
|||
|app| app.handler(
|
||||
|_| httpcodes::HTTPOk
|
||||
.build()
|
||||
.content_encoding(headers::ContentEncoding::Br)
|
||||
.content_encoding(header::ContentEncoding::Br)
|
||||
.body(STR)));
|
||||
|
||||
// client request
|
||||
|
@ -479,7 +479,7 @@ fn test_gzip_encoding() {
|
|||
.and_then(|bytes: Bytes| {
|
||||
Ok(httpcodes::HTTPOk
|
||||
.build()
|
||||
.content_encoding(headers::ContentEncoding::Identity)
|
||||
.content_encoding(header::ContentEncoding::Identity)
|
||||
.body(bytes))
|
||||
}).responder()}
|
||||
));
|
||||
|
@ -490,7 +490,7 @@ fn test_gzip_encoding() {
|
|||
let enc = e.finish().unwrap();
|
||||
|
||||
let request = srv.post()
|
||||
.header(header::CONTENT_ENCODING, "gzip")
|
||||
.header(header::http::CONTENT_ENCODING, "gzip")
|
||||
.body(enc.clone()).unwrap();
|
||||
let response = srv.execute(request.send()).unwrap();
|
||||
assert!(response.status().is_success());
|
||||
|
@ -508,7 +508,7 @@ fn test_gzip_encoding_large() {
|
|||
.and_then(|bytes: Bytes| {
|
||||
Ok(httpcodes::HTTPOk
|
||||
.build()
|
||||
.content_encoding(headers::ContentEncoding::Identity)
|
||||
.content_encoding(header::ContentEncoding::Identity)
|
||||
.body(bytes))
|
||||
}).responder()}
|
||||
));
|
||||
|
@ -519,7 +519,7 @@ fn test_gzip_encoding_large() {
|
|||
let enc = e.finish().unwrap();
|
||||
|
||||
let request = srv.post()
|
||||
.header(header::CONTENT_ENCODING, "gzip")
|
||||
.header(header::http::CONTENT_ENCODING, "gzip")
|
||||
.body(enc.clone()).unwrap();
|
||||
let response = srv.execute(request.send()).unwrap();
|
||||
assert!(response.status().is_success());
|
||||
|
@ -541,7 +541,7 @@ fn test_reading_gzip_encoding_large_random() {
|
|||
.and_then(|bytes: Bytes| {
|
||||
Ok(httpcodes::HTTPOk
|
||||
.build()
|
||||
.content_encoding(headers::ContentEncoding::Identity)
|
||||
.content_encoding(header::ContentEncoding::Identity)
|
||||
.body(bytes))
|
||||
}).responder()}
|
||||
));
|
||||
|
@ -552,7 +552,7 @@ fn test_reading_gzip_encoding_large_random() {
|
|||
let enc = e.finish().unwrap();
|
||||
|
||||
let request = srv.post()
|
||||
.header(header::CONTENT_ENCODING, "gzip")
|
||||
.header(header::http::CONTENT_ENCODING, "gzip")
|
||||
.body(enc.clone()).unwrap();
|
||||
let response = srv.execute(request.send()).unwrap();
|
||||
assert!(response.status().is_success());
|
||||
|
@ -570,7 +570,7 @@ fn test_reading_deflate_encoding() {
|
|||
.and_then(|bytes: Bytes| {
|
||||
Ok(httpcodes::HTTPOk
|
||||
.build()
|
||||
.content_encoding(headers::ContentEncoding::Identity)
|
||||
.content_encoding(header::ContentEncoding::Identity)
|
||||
.body(bytes))
|
||||
}).responder()}
|
||||
));
|
||||
|
@ -581,7 +581,7 @@ fn test_reading_deflate_encoding() {
|
|||
|
||||
// client request
|
||||
let request = srv.post()
|
||||
.header(header::CONTENT_ENCODING, "deflate")
|
||||
.header(header::http::CONTENT_ENCODING, "deflate")
|
||||
.body(enc).unwrap();
|
||||
let response = srv.execute(request.send()).unwrap();
|
||||
assert!(response.status().is_success());
|
||||
|
@ -599,7 +599,7 @@ fn test_reading_deflate_encoding_large() {
|
|||
.and_then(|bytes: Bytes| {
|
||||
Ok(httpcodes::HTTPOk
|
||||
.build()
|
||||
.content_encoding(headers::ContentEncoding::Identity)
|
||||
.content_encoding(header::ContentEncoding::Identity)
|
||||
.body(bytes))
|
||||
}).responder()}
|
||||
));
|
||||
|
@ -610,7 +610,7 @@ fn test_reading_deflate_encoding_large() {
|
|||
|
||||
// client request
|
||||
let request = srv.post()
|
||||
.header(header::CONTENT_ENCODING, "deflate")
|
||||
.header(header::http::CONTENT_ENCODING, "deflate")
|
||||
.body(enc).unwrap();
|
||||
let response = srv.execute(request.send()).unwrap();
|
||||
assert!(response.status().is_success());
|
||||
|
@ -632,7 +632,7 @@ fn test_reading_deflate_encoding_large_random() {
|
|||
.and_then(|bytes: Bytes| {
|
||||
Ok(httpcodes::HTTPOk
|
||||
.build()
|
||||
.content_encoding(headers::ContentEncoding::Identity)
|
||||
.content_encoding(header::ContentEncoding::Identity)
|
||||
.body(bytes))
|
||||
}).responder()}
|
||||
));
|
||||
|
@ -643,7 +643,7 @@ fn test_reading_deflate_encoding_large_random() {
|
|||
|
||||
// client request
|
||||
let request = srv.post()
|
||||
.header(header::CONTENT_ENCODING, "deflate")
|
||||
.header(header::http::CONTENT_ENCODING, "deflate")
|
||||
.body(enc).unwrap();
|
||||
let response = srv.execute(request.send()).unwrap();
|
||||
assert!(response.status().is_success());
|
||||
|
@ -662,7 +662,7 @@ fn test_brotli_encoding() {
|
|||
.and_then(|bytes: Bytes| {
|
||||
Ok(httpcodes::HTTPOk
|
||||
.build()
|
||||
.content_encoding(headers::ContentEncoding::Identity)
|
||||
.content_encoding(header::ContentEncoding::Identity)
|
||||
.body(bytes))
|
||||
}).responder()}
|
||||
));
|
||||
|
@ -673,7 +673,7 @@ fn test_brotli_encoding() {
|
|||
|
||||
// client request
|
||||
let request = srv.post()
|
||||
.header(header::CONTENT_ENCODING, "br")
|
||||
.header(header::http::CONTENT_ENCODING, "br")
|
||||
.body(enc).unwrap();
|
||||
let response = srv.execute(request.send()).unwrap();
|
||||
assert!(response.status().is_success());
|
||||
|
@ -692,7 +692,7 @@ fn test_brotli_encoding_large() {
|
|||
.and_then(|bytes: Bytes| {
|
||||
Ok(httpcodes::HTTPOk
|
||||
.build()
|
||||
.content_encoding(headers::ContentEncoding::Identity)
|
||||
.content_encoding(header::ContentEncoding::Identity)
|
||||
.body(bytes))
|
||||
}).responder()}
|
||||
));
|
||||
|
@ -703,7 +703,7 @@ fn test_brotli_encoding_large() {
|
|||
|
||||
// client request
|
||||
let request = srv.post()
|
||||
.header(header::CONTENT_ENCODING, "br")
|
||||
.header(header::http::CONTENT_ENCODING, "br")
|
||||
.body(enc).unwrap();
|
||||
let response = srv.execute(request.send()).unwrap();
|
||||
assert!(response.status().is_success());
|
||||
|
|
Loading…
Reference in a new issue