Struct HttpRequest
Source pub struct HttpRequest {
pub method: Method,
pub url: String,
pub headers: HashMap<String, String>,
pub body: Body,
pub config: RequestConfig,
pub tmp: Tmp,
}
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.
HTTP method (Method::Get / Method::Post / …).
Target URL (string form, parsed on send).
Request headers (single-value).
§body: BodyPer-request config: timeout, redirects, proxy, decode, etc.
Internal scratch: redirect-loop tracking + TLS root store.
Private; only HttpRequest methods touch it.
Send the HTTP request synchronously, returning the parsed response.
§Returns
RequestResult - The parsed HTTP response, or a RequestError on failure.
Send the HTTP request asynchronously, returning the parsed response.
§Returns
RequestResult - The parsed HTTP response, or a RequestError on failure.
Create a GET request for url.
§Arguments
T - The request URL, converted into an owned String.
Create a POST request for url.
§Arguments
T - The request URL, converted into an owned String.
Builder-style: set method.
§Arguments
Method - The HTTP method to use for the request.
§Returns
&mut Self - The request itself, for chaining.
Builder-style: set URL.
§Arguments
T - The request URL, converted into an owned String.
§Returns
&mut Self - The request itself, for chaining.
Builder-style: set a single header (case-insensitive on read; the
last value wins for repeated keys).
§Arguments
K - The header name, normalised to lowercase.
V - The header value, stored as an owned String.
§Returns
&mut Self - The request itself, for chaining.
Remove a header by key.
§Arguments
K - The header name to remove, matched case-insensitively.
§Returns
&mut Self - The request itself, for chaining.
Clear all headers.
§Returns
&mut Self - The request itself, for chaining.
Set body (raw bytes).
§Arguments
Body - The body payload to send.
§Returns
&mut Self - The request itself, for chaining.
Set a single config field by mutating the embedded RequestConfig.
§Arguments
RequestConfig - The configuration replacing the current one.
§Returns
&mut Self - The request itself, for chaining.
Performs copy-assignment from
source.
Read more
Formats the value using the given formatter.
Read more
Returns the “default value” for a type.
Read more
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from
self to
dest.
Read more
Returns the argument unchanged.
Calls U::from(self).
That is, this conversion is whatever the implementation of
From<T> for U chooses to do.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more
Uses borrowed data to replace owned data, usually by cloning.
Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.