Struct easy_http_request::HttpRequest
source · [−]pub struct HttpRequest<QK = String, QV = String, BK = String, BV = String, HK = String, HV = String> where
QK: Eq + Hash + AsRef<str>,
QV: AsRef<str>,
BK: Eq + Hash + AsRef<str>,
BV: AsRef<str>,
HK: Eq + Hash + AsRef<str>,
HV: AsRef<str>, {
pub method: HttpRequestMethod,
pub url: Url,
pub query: Option<HashMap<QK, QV>>,
pub body: Option<HttpRequestBody<BK, BV>>,
pub headers: Option<HashMap<HK, HV>>,
pub options: HttpRequestOptions,
}
Expand description
The http request sender. See DefaultHttpRequest
or StaticHttpRequest
.
Fields
method: HttpRequestMethod
url: Url
query: Option<HashMap<QK, QV>>
body: Option<HttpRequestBody<BK, BV>>
headers: Option<HashMap<HK, HV>>
options: HttpRequestOptions
Implementations
sourceimpl<QK: Eq + Hash + AsRef<str>, QV: AsRef<str>, BK: Eq + Hash + AsRef<str>, BV: AsRef<str>, HK: Eq + Hash + AsRef<str>, HV: AsRef<str>> HttpRequest<QK, QV, BK, BV, HK, HV>
impl<QK: Eq + Hash + AsRef<str>, QV: AsRef<str>, BK: Eq + Hash + AsRef<str>, BV: AsRef<str>, HK: Eq + Hash + AsRef<str>, HV: AsRef<str>> HttpRequest<QK, QV, BK, BV, HK, HV>
pub fn new(
method: HttpRequestMethod,
url: Url
) -> HttpRequest<QK, QV, BK, BV, HK, HV>
pub fn get(url: Url) -> HttpRequest<QK, QV, BK, BV, HK, HV>
pub fn get_from_url_str<S: AsRef<str>>(
url: S
) -> Result<HttpRequest<QK, QV, BK, BV, HK, HV>, HttpRequestError>
pub fn post(url: Url) -> HttpRequest<QK, QV, BK, BV, HK, HV>
pub fn post_from_url_str<S: AsRef<str>>(
url: S
) -> Result<HttpRequest<QK, QV, BK, BV, HK, HV>, HttpRequestError>
pub fn put(url: Url) -> HttpRequest<QK, QV, BK, BV, HK, HV>
pub fn put_from_url_str<S: AsRef<str>>(
url: S
) -> Result<HttpRequest<QK, QV, BK, BV, HK, HV>, HttpRequestError>
pub fn delete(url: Url) -> HttpRequest<QK, QV, BK, BV, HK, HV>
pub fn delete_from_url_str<S: AsRef<str>>(
url: S
) -> Result<HttpRequest<QK, QV, BK, BV, HK, HV>, HttpRequestError>
pub fn head(url: Url) -> HttpRequest<QK, QV, BK, BV, HK, HV>
pub fn head_from_url_str<S: AsRef<str>>(
url: S
) -> Result<HttpRequest<QK, QV, BK, BV, HK, HV>, HttpRequestError>
sourcepub fn send(self) -> Result<HttpResponse, HttpRequestError>
pub fn send(self) -> Result<HttpResponse, HttpRequestError>
Send a request and drop this sender.
sourcepub fn send_preserved(&self) -> Result<HttpResponse, HttpRequestError>
pub fn send_preserved(&self) -> Result<HttpResponse, HttpRequestError>
Send a request and preserve this sender so that it can be used again.
Trait Implementations
sourceimpl<QK, QV, BK, BV, HK, HV> Clone for HttpRequest<QK, QV, BK, BV, HK, HV> where
QK: Eq + Hash + AsRef<str>,
QV: AsRef<str>,
BK: Eq + Hash + AsRef<str>,
BV: AsRef<str>,
HK: Eq + Hash + AsRef<str>,
HV: AsRef<str>,
QK: Clone,
QV: Clone,
BK: Clone,
BV: Clone,
HK: Clone,
HV: Clone,
impl<QK, QV, BK, BV, HK, HV> Clone for HttpRequest<QK, QV, BK, BV, HK, HV> where
QK: Eq + Hash + AsRef<str>,
QV: AsRef<str>,
BK: Eq + Hash + AsRef<str>,
BV: AsRef<str>,
HK: Eq + Hash + AsRef<str>,
HV: AsRef<str>,
QK: Clone,
QV: Clone,
BK: Clone,
BV: Clone,
HK: Clone,
HV: Clone,
Auto Trait Implementations
impl<QK, QV, BK, BV, HK, HV> RefUnwindSafe for HttpRequest<QK, QV, BK, BV, HK, HV> where
BK: RefUnwindSafe,
BV: RefUnwindSafe,
HK: RefUnwindSafe,
HV: RefUnwindSafe,
QK: RefUnwindSafe,
QV: RefUnwindSafe,
impl<QK, QV, BK, BV, HK, HV> Send for HttpRequest<QK, QV, BK, BV, HK, HV> where
BK: Send,
BV: Send,
HK: Send,
HV: Send,
QK: Send,
QV: Send,
impl<QK, QV, BK, BV, HK, HV> Sync for HttpRequest<QK, QV, BK, BV, HK, HV> where
BK: Sync,
BV: Sync,
HK: Sync,
HV: Sync,
QK: Sync,
QV: Sync,
impl<QK, QV, BK, BV, HK, HV> Unpin for HttpRequest<QK, QV, BK, BV, HK, HV> where
BK: Unpin,
BV: Unpin,
HK: Unpin,
HV: Unpin,
QK: Unpin,
QV: Unpin,
impl<QK, QV, BK, BV, HK, HV> UnwindSafe for HttpRequest<QK, QV, BK, BV, HK, HV> where
BK: UnwindSafe,
BV: UnwindSafe,
HK: UnwindSafe,
HV: UnwindSafe,
QK: UnwindSafe,
QV: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more