pub struct Request { /* private fields */ }Expand description
An incoming HTTP request from the Cufflink platform.
The platform serializes the full request context (method, headers, body, tenant, service name, auth) into JSON and passes it to your handler.
Implementations§
Source§impl Request
impl Request
Sourcepub fn from_json(json: &str) -> Option<Self>
pub fn from_json(json: &str) -> Option<Self>
Parse a Request from the JSON the platform provides.
Sourcepub fn raw_body(&self) -> &[u8] ⓘ
pub fn raw_body(&self) -> &[u8] ⓘ
The raw, unparsed request body bytes as the caller sent them.
Use this when verifying webhook signatures that HMAC over the
original payload (Stripe, OpenPhone/Quo, etc.) — the parsed
body() is canonicalized by serde_json and will not byte-match
what the sender signed. Returns an empty slice when no body was
sent.
Sourcepub fn auth(&self) -> Option<&Auth>
pub fn auth(&self) -> Option<&Auth>
Get the authenticated user context, if present.
Returns None if no valid JWT or API key was provided with the request.
Sourcepub fn job(&self) -> Option<&JobContext>
pub fn job(&self) -> Option<&JobContext>
Get the job context attached by the long-running jobs runtime.
Returns None when the handler is invoked directly via HTTP. Present
for handlers annotated with job(...) and dispatched by a worker.