[][src]Trait isahc::RequestExt

pub trait RequestExt<T> {
    pub fn to_builder(&self) -> Builder;
pub fn send(self) -> Result<Response<Body>, Error>
    where
        T: Into<Body>
;
pub fn send_async(self) -> ResponseFuture<'static>

Notable traits for ResponseFuture<'_>

impl<'_> Future for ResponseFuture<'_> type Output = Result<Response<Body>, Error>;

    where
        T: Into<Body>
; }

Extension methods on an HTTP request.

Required methods

pub fn to_builder(&self) -> Builder[src]

Create a new request builder with the method, URI, and headers cloned from this request.

Note that third-party extensions are not cloned.

pub fn send(self) -> Result<Response<Body>, Error> where
    T: Into<Body>, 
[src]

Send the HTTP request synchronously using the default client.

This is a convenience method that is equivalent to send.

Examples

use isahc::prelude::*;

let response = Request::post("https://httpbin.org/post")
    .header("Content-Type", "application/json")
    .body(r#"{
        "speed": "fast",
        "cool_name": true
    }"#)?
    .send()?;

pub fn send_async(self) -> ResponseFuture<'static>

Notable traits for ResponseFuture<'_>

impl<'_> Future for ResponseFuture<'_> type Output = Result<Response<Body>, Error>;
where
    T: Into<Body>, 
[src]

Sends the HTTP request asynchronously using the default client.

This is a convenience method that is equivalent to send_async.

Loading content...

Implementations on Foreign Types

impl<T> RequestExt<T> for Request<T>[src]

Loading content...

Implementors

Loading content...