Skip to main content

AsyncHttpRequest

Struct AsyncHttpRequest 

Source
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

Source

pub fn new() -> Self

Source

pub fn from_value(value: &Value) -> Self

Parse the map shape (the envelope body of an async.http.request event).

Source

pub fn to_value(&self) -> Value

Render the Java toMap() shape for the envelope body.

Source

pub fn set_method(self, method: &str) -> Self

Source

pub fn set_url(self, url: &str) -> Self

Source

pub fn set_target_host(self, host: &str) -> Self

Source

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.

Source

pub fn set_header(self, key: &str, value: &str) -> Self

Set (or replace, case-insensitively) a request header.

Source

pub fn set_body(self, body: Value) -> Self

Source

pub fn set_query_parameter(self, key: &str, value: &str) -> Self

Set (or replace — Java setQueryParameter put semantics) a single-value query parameter.

Source

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).

Source

pub fn set_path_parameter(self, key: &str, value: &str) -> Self

Set (or replace) a cookie (Java setCookie).

Source

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.

Source

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.

Source

pub fn set_secure(self, https: bool) -> Self

Whether the original request arrived over HTTPS (Java setSecure).

Source

pub fn set_query_string(self, query: &str) -> Self

The raw query string (Java setQueryString).

Source

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.

Source

pub fn set_timeout_seconds(self, timeout_seconds: u64) -> Self

Java setTimeoutSeconds: the TTL travels as the x-ttl header (ms).

Source

pub fn method(&self) -> &str

Source

pub fn url(&self) -> &str

The request URI path (Java AsyncHttpRequest.getUrl).

Source

pub fn target_host(&self) -> Option<&str>

Source

pub fn trust_all_cert(&self) -> bool

Source

pub fn headers(&self) -> &[(String, String)]

All request headers in insertion order.

Source

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.

Source

pub fn header(&self, key: &str) -> Option<&str>

Source

pub fn body(&self) -> &Value

Source

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.

Source

pub fn body_as<T: DeserializeOwned>(&self) -> Result<T, AppError>

Deserialize the request body into a typed value (Java AsyncHttpRequest.getBody(Class<T>)).

Source

pub fn remote_ip(&self) -> Option<&str>

The caller’s IP address (Java AsyncHttpRequest.getRemoteIp) — set by the REST edge on the request dataset.

Source

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).

Source

pub fn query_string(&self) -> Option<&str>

The raw query string (Java AsyncHttpRequest.getQueryString).

Source

pub fn path_parameter(&self, key: &str) -> Option<&str>

One {path} parameter by name (Java getPathParameter).

Source

pub fn path_parameters(&self) -> &[(String, String)]

All {path} parameters (Java getPathParameters).

Source

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.

Source

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.

Source

pub fn cookie(&self, key: &str) -> Option<&str>

One cookie by name (Java getCookie).

Source

pub fn cookies(&self) -> &[(String, String)]

All cookies as parsed by the REST edge (Java getCookies).

Source

pub fn session_info(&self, key: &str) -> Option<&str>

One session-info entry by name (Java getSessionInfo(String)).

Source

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

Source§

fn clone(&self) -> AsyncHttpRequest

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AsyncHttpRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AsyncHttpRequest

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
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.

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for AsyncHttpRequest

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V