pub struct HttpRequest {
pub method: Method,
pub url: String,
pub headers: HashMap<String, String>,
pub body: Body,
pub config: RequestConfig,
/* private fields */
}Expand description
HTTP request data and execution state.
Holds everything needed to issue one outgoing request: method, URL,
headers (single-value HashMap<String, String> — see
hyperlane-standards §8.1), body, and per-request config (timeout,
redirect policy, proxy, decode, etc.).
HttpRequest is constructed either via crate::RequestBuilder or
directly from its public fields, then sent via HttpRequest::send
(sync) or HttpRequest::send_async.
Fields§
§method: MethodHTTP method (Method::Get / Method::Post / …).
url: StringTarget URL (string form, parsed on send).
headers: HashMap<String, String>Request headers (single-value).
body: BodyRequest body.
config: RequestConfigPer-request config: timeout, redirects, proxy, decode, etc.
Implementations§
Source§impl HttpRequest
impl HttpRequest
Sourcepub fn send(&mut self) -> RequestResult
pub fn send(&mut self) -> RequestResult
Send the HTTP request synchronously, returning the parsed response.
Sourcepub async fn send_async(&mut self) -> RequestResult
pub async fn send_async(&mut self) -> RequestResult
Send the HTTP request asynchronously, returning the parsed response.
Source§impl HttpRequest
impl HttpRequest
Sourcepub fn set_method(&mut self, method: Method) -> &mut Self
pub fn set_method(&mut self, method: Method) -> &mut Self
Builder-style: set method.
Sourcepub fn set_header<K: AsRef<str>, V: AsRef<str>>(
&mut self,
key: K,
value: V,
) -> &mut Self
pub fn set_header<K: AsRef<str>, V: AsRef<str>>( &mut self, key: K, value: V, ) -> &mut Self
Builder-style: set a single header (case-insensitive on read; the last value wins for repeated keys).
Sourcepub fn remove_header<K: AsRef<str>>(&mut self, key: K) -> &mut Self
pub fn remove_header<K: AsRef<str>>(&mut self, key: K) -> &mut Self
Remove a header by key.
Sourcepub fn clear_headers(&mut self) -> &mut Self
pub fn clear_headers(&mut self) -> &mut Self
Clear all headers.
Sourcepub fn set_config(&mut self, config: RequestConfig) -> &mut Self
pub fn set_config(&mut self, config: RequestConfig) -> &mut Self
Set a single config field by mutating the embedded RequestConfig.