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 max_response_body_size: usize,
pub query: Option<HashMap<QK, QV>>,
pub body: Option<HttpRequestBody<BK, BV>>,
pub headers: Option<HashMap<HK, HV>>,
}
Expand description
The http request sender. See DefaultHttpRequest
or StaticHttpRequest
.
Fields
method: HttpRequestMethod
url: Url
max_response_body_size: usize
The size limit of the response body.
query: Option<HashMap<QK, QV>>
body: Option<HttpRequestBody<BK, BV>>
headers: Option<HashMap<HK, HV>>
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.
sourceimpl<QK: Eq + Hash + AsRef<str>, QV: AsRef<str>, BK: Eq + Hash + AsRef<str> + Clone, BV: AsRef<str> + Clone, 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> + Clone, BV: AsRef<str> + Clone, HK: Eq + Hash + AsRef<str>, HV: AsRef<str>> HttpRequest<QK, QV, BK, BV, HK, HV>
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: Eq + Hash + AsRef<str> + Clone, QV: AsRef<str> + Clone, BK: Eq + Hash + AsRef<str> + Clone, BV: AsRef<str> + Clone, HK: Eq + Hash + AsRef<str> + Clone, HV: AsRef<str> + Clone> Clone for HttpRequest<QK, QV, BK, BV, HK, HV>
impl<QK: Eq + Hash + AsRef<str> + Clone, QV: AsRef<str> + Clone, BK: Eq + Hash + AsRef<str> + Clone, BV: AsRef<str> + Clone, HK: Eq + Hash + AsRef<str> + Clone, HV: AsRef<str> + Clone> Clone for HttpRequest<QK, QV, BK, BV, HK, HV>
sourcefn clone(&self) -> HttpRequest<QK, QV, BK, BV, HK, HV>
fn clone(&self) -> HttpRequest<QK, QV, BK, BV, HK, HV>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto 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 Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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