mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 07:53:00 +01:00
remove unused code
This commit is contained in:
parent
959aebb24f
commit
b7570b2476
@ -65,13 +65,14 @@ impl ClientBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Do not add default request headers.
|
/// Do not add default request headers.
|
||||||
/// By default `Accept-Encoding` and `User-Agent` headers are set.
|
/// By default `Date` and `User-Agent` headers are set.
|
||||||
pub fn skip_default_headers(mut self) -> Self {
|
pub fn no_default_headers(mut self) -> Self {
|
||||||
self.default_headers = false;
|
self.default_headers = false;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add default header. This header adds to every request.
|
/// Add default header. Headers adds byt this method
|
||||||
|
/// get added to every request.
|
||||||
pub fn header<K, V>(mut self, key: K, value: V) -> Self
|
pub fn header<K, V>(mut self, key: K, value: V) -> Self
|
||||||
where
|
where
|
||||||
HeaderName: HttpTryFrom<K>,
|
HeaderName: HttpTryFrom<K>,
|
||||||
@ -91,7 +92,7 @@ impl ClientBuilder {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Finish build process and create `Client`.
|
/// Finish build process and create `Client` instance.
|
||||||
pub fn finish(self) -> Client {
|
pub fn finish(self) -> Client {
|
||||||
Client {
|
Client {
|
||||||
connector: self.connector,
|
connector: self.connector,
|
||||||
|
@ -141,13 +141,11 @@ impl ClientRequest {
|
|||||||
/// To override header use `set_header()` method.
|
/// To override header use `set_header()` method.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// # extern crate actix_http;
|
/// use awc::{http, Client};
|
||||||
/// #
|
|
||||||
/// use actix_http::{client, http};
|
|
||||||
///
|
///
|
||||||
/// fn main() {
|
/// fn main() {
|
||||||
/// # actix_rt::System::new("test").block_on(futures::future::lazy(|| {
|
/// # actix_rt::System::new("test").block_on(futures::future::lazy(|| {
|
||||||
/// let req = awc::Client::new()
|
/// let req = Client::new()
|
||||||
/// .get("http://www.rust-lang.org")
|
/// .get("http://www.rust-lang.org")
|
||||||
/// .header("X-TEST", "value")
|
/// .header("X-TEST", "value")
|
||||||
/// .header(http::header::CONTENT_TYPE, "application/json");
|
/// .header(http::header::CONTENT_TYPE, "application/json");
|
||||||
@ -304,7 +302,7 @@ impl ClientRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Do not add default request headers.
|
/// Do not add default request headers.
|
||||||
/// By default `Accept-Encoding` and `User-Agent` headers are set.
|
/// By default `Date` and `User-Agent` headers are set.
|
||||||
pub fn no_default_headers(mut self) -> Self {
|
pub fn no_default_headers(mut self) -> Self {
|
||||||
self.default_headers = false;
|
self.default_headers = false;
|
||||||
self
|
self
|
||||||
@ -394,7 +392,7 @@ impl ClientRequest {
|
|||||||
// user agent
|
// user agent
|
||||||
self.set_header_if_none(
|
self.set_header_if_none(
|
||||||
header::USER_AGENT,
|
header::USER_AGENT,
|
||||||
concat!("actix-http/", env!("CARGO_PKG_VERSION")),
|
concat!("awc/", env!("CARGO_PKG_VERSION")),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
self
|
self
|
||||||
|
@ -71,11 +71,6 @@ impl<S> ClientResponse<S> {
|
|||||||
&self.head
|
&self.head
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub(crate) fn head_mut(&mut self) -> &mut ResponseHead {
|
|
||||||
&mut self.head
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Read the Request Version.
|
/// Read the Request Version.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn version(&self) -> Version {
|
pub fn version(&self) -> Version {
|
||||||
@ -94,18 +89,6 @@ impl<S> ClientResponse<S> {
|
|||||||
&self.head().headers
|
&self.head().headers
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
/// Returns mutable Request's headers.
|
|
||||||
pub fn headers_mut(&mut self) -> &mut HeaderMap {
|
|
||||||
&mut self.head_mut().headers
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Checks if a connection should be kept alive.
|
|
||||||
#[inline]
|
|
||||||
pub fn keep_alive(&self) -> bool {
|
|
||||||
self.head().keep_alive()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Set a body and return previous body value
|
/// Set a body and return previous body value
|
||||||
pub fn map_body<F, U>(mut self, f: F) -> ClientResponse<U>
|
pub fn map_body<F, U>(mut self, f: F) -> ClientResponse<U>
|
||||||
where
|
where
|
||||||
|
Loading…
Reference in New Issue
Block a user