[−][src]Struct actix_web::client::ClientRequest
An HTTP Client Request
use actix_web::{actix, client}; fn main() { actix::run( || client::ClientRequest::get("http://www.rust-lang.org") // <- Create request builder .header("User-Agent", "Actix-web") .finish().unwrap() .send() // <- Send http request .map_err(|_| ()) .and_then(|response| { // <- server http response println!("Response: {:?}", response); Ok(()) }), ); }
Methods
impl ClientRequest
[src]
impl ClientRequest
pub fn get<U: AsRef<str>>(uri: U) -> ClientRequestBuilder
[src]
pub fn get<U: AsRef<str>>(uri: U) -> ClientRequestBuilder
Create request builder for GET
request
pub fn head<U: AsRef<str>>(uri: U) -> ClientRequestBuilder
[src]
pub fn head<U: AsRef<str>>(uri: U) -> ClientRequestBuilder
Create request builder for HEAD
request
pub fn post<U: AsRef<str>>(uri: U) -> ClientRequestBuilder
[src]
pub fn post<U: AsRef<str>>(uri: U) -> ClientRequestBuilder
Create request builder for POST
request
pub fn put<U: AsRef<str>>(uri: U) -> ClientRequestBuilder
[src]
pub fn put<U: AsRef<str>>(uri: U) -> ClientRequestBuilder
Create request builder for PUT
request
pub fn delete<U: AsRef<str>>(uri: U) -> ClientRequestBuilder
[src]
pub fn delete<U: AsRef<str>>(uri: U) -> ClientRequestBuilder
Create request builder for DELETE
request
impl ClientRequest
[src]
impl ClientRequest
pub fn build() -> ClientRequestBuilder
[src]
pub fn build() -> ClientRequestBuilder
Create client request builder
pub fn build_from<T: Into<ClientRequestBuilder>>(
source: T
) -> ClientRequestBuilder
[src]
pub fn build_from<T: Into<ClientRequestBuilder>>(
source: T
) -> ClientRequestBuilder
Create client request builder
pub fn uri(&self) -> &Uri
[src]
pub fn uri(&self) -> &Uri
Get the request URI
pub fn set_uri(&mut self, uri: Uri)
[src]
pub fn set_uri(&mut self, uri: Uri)
Set client request URI
pub fn method(&self) -> &Method
[src]
pub fn method(&self) -> &Method
Get the request method
pub fn set_method(&mut self, method: Method)
[src]
pub fn set_method(&mut self, method: Method)
Set HTTP Method
for the request
pub fn version(&self) -> Version
[src]
pub fn version(&self) -> Version
Get HTTP version for the request
pub fn set_version(&mut self, version: Version)
[src]
pub fn set_version(&mut self, version: Version)
Set http Version
for the request
pub fn headers(&self) -> &HeaderMap
[src]
pub fn headers(&self) -> &HeaderMap
Get the headers from the request
pub fn headers_mut(&mut self) -> &mut HeaderMap
[src]
pub fn headers_mut(&mut self) -> &mut HeaderMap
Get a mutable reference to the headers
pub fn chunked(&self) -> bool
[src]
pub fn chunked(&self) -> bool
is chunked encoding enabled
pub fn upgrade(&self) -> bool
[src]
pub fn upgrade(&self) -> bool
is upgrade request
pub fn content_encoding(&self) -> ContentEncoding
[src]
pub fn content_encoding(&self) -> ContentEncoding
Content encoding
pub fn response_decompress(&self) -> bool
[src]
pub fn response_decompress(&self) -> bool
Decompress response payload
pub fn write_buffer_capacity(&self) -> usize
[src]
pub fn write_buffer_capacity(&self) -> usize
Requested write buffer capacity
pub fn body(&self) -> &Body
[src]
pub fn body(&self) -> &Body
Get body of this response
pub fn set_body<B: Into<Body>>(&mut self, body: B)
[src]
pub fn set_body<B: Into<Body>>(&mut self, body: B)
Set a body
pub fn send(self) -> SendRequest
[src]
pub fn send(self) -> SendRequest
Send request
This method returns a future that resolves to a ClientResponse
Trait Implementations
impl Default for ClientRequest
[src]
impl Default for ClientRequest
fn default() -> ClientRequest
[src]
fn default() -> ClientRequest
Returns the "default value" for a type. Read more
impl Debug for ClientRequest
[src]
impl Debug for ClientRequest
Auto Trait Implementations
impl !Send for ClientRequest
impl !Send for ClientRequest
impl !Sync for ClientRequest
impl !Sync for ClientRequest
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<T> Erased for T
impl<T> Erased for T