Struct actix_web::client::ClientRequest [−][src]
pub struct ClientRequest { /* fields omitted */ }
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