pub struct AsyncHttpRequest { /* private fields */ }Expand description
The HTTP request contract (Java AsyncHttpRequest): a map-backed model
with method, url, host, headers, body, parameters.query,
parameters.path, cookies, session and the server-side dataset keys
(ip, https, timeout, raw query). Programmatic callers build it
with the fluent setters; declarative callers (flow data mapping) build
the same map shape directly; a typed function
(TypedFunction<AsyncHttpRequest, O> + #[preload(..., typed)]) receives
it deserialized from the REST edge’s request dataset — see the
Deserialize impl below.
Implementations§
Source§impl AsyncHttpRequest
impl AsyncHttpRequest
pub fn new() -> Self
Sourcepub fn from_value(value: &Value) -> Self
pub fn from_value(value: &Value) -> Self
Parse the map shape (the envelope body of an async.http.request
event).
pub fn set_method(self, method: &str) -> Self
pub fn set_url(self, url: &str) -> Self
pub fn set_target_host(self, host: &str) -> Self
Sourcepub fn set_trust_all_cert(self, trust_all_cert: bool) -> Self
pub fn set_trust_all_cert(self, trust_all_cert: bool) -> Self
Java setTrustAllCert: skip certificate-chain validation for an
https target (self-signed endpoints). Ignored for plain http.
Sourcepub fn set_header(self, key: &str, value: &str) -> Self
pub fn set_header(self, key: &str, value: &str) -> Self
Set (or replace, case-insensitively) a request header.
pub fn set_body(self, body: Value) -> Self
Sourcepub fn set_query_parameter(self, key: &str, value: &str) -> Self
pub fn set_query_parameter(self, key: &str, value: &str) -> Self
Set (or replace — Java setQueryParameter put semantics) a
single-value query parameter.
Sourcepub fn set_query_parameter_values(self, key: &str, values: &[&str]) -> Self
pub fn set_query_parameter_values(self, key: &str, values: &[&str]) -> Self
Set a REPEATED query parameter (the list shape the REST edge produces
for ?q=a&q=b — Java setQueryParameter with a List value).
pub fn set_path_parameter(self, key: &str, value: &str) -> Self
Set (or replace) a cookie (Java setCookie).
Sourcepub fn set_session_info(self, key: &str, value: &str) -> Self
pub fn set_session_info(self, key: &str, value: &str) -> Self
Set (or replace) a session-info entry (Java setSessionInfo) — on the
server side these arrive from the authentication service’s verdict.
Sourcepub fn set_remote_ip(self, ip: &str) -> Self
pub fn set_remote_ip(self, ip: &str) -> Self
The caller’s IP address (Java setRemoteIp) — the REST edge stamps it
on the request dataset.
Sourcepub fn set_secure(self, https: bool) -> Self
pub fn set_secure(self, https: bool) -> Self
Whether the original request arrived over HTTPS (Java setSecure).
Sourcepub fn set_query_string(self, query: &str) -> Self
pub fn set_query_string(self, query: &str) -> Self
The raw query string (Java setQueryString).
Sourcepub fn set_route_timeout_seconds(self, seconds: u64) -> Self
pub fn set_route_timeout_seconds(self, seconds: u64) -> Self
The ROUTE timeout in seconds — the REST edge’s timeout dataset key
(rest.yaml endpoint timeout). Distinct from [set_timeout_seconds],
which writes the caller’s TTL as the x-ttl header (milliseconds,
Java setTimeoutSeconds); on read, timeout_seconds() prefers a
caller-sent x-ttl and falls back to this field — the ingress
precedence.
Sourcepub fn set_timeout_seconds(self, timeout_seconds: u64) -> Self
pub fn set_timeout_seconds(self, timeout_seconds: u64) -> Self
Java setTimeoutSeconds: the TTL travels as the x-ttl header (ms).
pub fn method(&self) -> &str
pub fn target_host(&self) -> Option<&str>
pub fn trust_all_cert(&self) -> bool
Sourcepub fn session(&self) -> &[(String, String)]
pub fn session(&self) -> &[(String, String)]
Session info injected by an authentication service (Java
AsyncHttpRequest.getSessionInfo): headers returned on the auth
verdict, riding to the target function as read-only headers.
pub fn header(&self, key: &str) -> Option<&str>
pub fn body(&self) -> &Value
Sourcepub fn timeout_seconds(&self) -> u64
pub fn timeout_seconds(&self) -> u64
Java AsyncHttpRequest.getTimeoutSeconds(): the x-ttl header is in
milliseconds and a fractional second must round UP, never down
(1,500 ms is a 2-second budget, not 1) — otherwise the wire-level
read timeout fires before a peer that spends its whole TTL replies.
Sourcepub fn body_as<T: DeserializeOwned>(&self) -> Result<T, AppError>
pub fn body_as<T: DeserializeOwned>(&self) -> Result<T, AppError>
Deserialize the request body into a typed value (Java
AsyncHttpRequest.getBody(Class<T>)).
Sourcepub fn remote_ip(&self) -> Option<&str>
pub fn remote_ip(&self) -> Option<&str>
The caller’s IP address (Java AsyncHttpRequest.getRemoteIp) — set
by the REST edge on the request dataset.
Sourcepub fn is_secure(&self) -> bool
pub fn is_secure(&self) -> bool
Whether the original request arrived over HTTPS (Java
AsyncHttpRequest.isSecure; the REST edge derives it from
x-forwarded-proto).
Sourcepub fn query_string(&self) -> Option<&str>
pub fn query_string(&self) -> Option<&str>
The raw query string (Java AsyncHttpRequest.getQueryString).
Sourcepub fn path_parameter(&self, key: &str) -> Option<&str>
pub fn path_parameter(&self, key: &str) -> Option<&str>
One {path} parameter by name (Java getPathParameter).
Sourcepub fn path_parameters(&self) -> &[(String, String)]
pub fn path_parameters(&self) -> &[(String, String)]
All {path} parameters (Java getPathParameters).
Sourcepub fn query_parameter(&self, key: &str) -> Option<String>
pub fn query_parameter(&self, key: &str) -> Option<String>
One query parameter as text (Java getQueryParameter): a repeated
parameter (list value) yields its FIRST occurrence.
Sourcepub fn query_parameters(&self, key: &str) -> Vec<String>
pub fn query_parameters(&self, key: &str) -> Vec<String>
Every value of a query parameter (Java getQueryParameters): one
occurrence is a one-element list, repeats keep every value.
One cookie by name (Java getCookie).
All cookies as parsed by the REST edge (Java getCookies).
Sourcepub fn session_info(&self, key: &str) -> Option<&str>
pub fn session_info(&self, key: &str) -> Option<&str>
One session-info entry by name (Java getSessionInfo(String)).
Sourcepub fn finalized_url(&self) -> String
pub fn finalized_url(&self) -> String
Java getFinalizedUrl: substitute {path} parameters, merge query
parameters into the query string, and keep any #hash suffix.
Trait Implementations§
Source§impl Clone for AsyncHttpRequest
impl Clone for AsyncHttpRequest
Source§fn clone(&self) -> AsyncHttpRequest
fn clone(&self) -> AsyncHttpRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AsyncHttpRequest
impl Debug for AsyncHttpRequest
Source§impl Default for AsyncHttpRequest
impl Default for AsyncHttpRequest
Source§impl<'de> Deserialize<'de> for AsyncHttpRequest
Typed-function support (the maintainer-agreed design, 2026-07-26): the
two serde traits are thin delegates onto the existing map-shape parser
and builder, so #[preload(..., typed)] +
TypedFunction<AsyncHttpRequest, O> flows through the ordinary
TypedAdapter (body_as::<I>()) with ZERO worker special-casing — the
knowledge lives on the type, not in the engine (Java, by contrast,
special-cases AsyncHttpRequest.class inside WorkerHandler.getMapBody).
This is the template rule for the Python/Node ports: their request
classes must be constructible from the request map so typed signatures
just work.
impl<'de> Deserialize<'de> for AsyncHttpRequest
Typed-function support (the maintainer-agreed design, 2026-07-26): the
two serde traits are thin delegates onto the existing map-shape parser
and builder, so #[preload(..., typed)] +
TypedFunction<AsyncHttpRequest, O> flows through the ordinary
TypedAdapter (body_as::<I>()) with ZERO worker special-casing — the
knowledge lives on the type, not in the engine (Java, by contrast,
special-cases AsyncHttpRequest.class inside WorkerHandler.getMapBody).
This is the template rule for the Python/Node ports: their request
classes must be constructible from the request map so typed signatures
just work.