pub struct ResponseContext {
pub status: u16,
pub headers: HeaderMap,
pub body: Vec<u8>,
pub was_sse: bool,
pub json: Option<Value>,
pub rpc_error: Option<(i64, String)>,
pub upstream_us: Option<u64>,
}Expand description
Response-side state threaded through the response middleware chain.
Middleware mutate body and json in place. Handlers instantiate after
reading the upstream body and finalize by building an axum::Response from
(status, headers, body).
Fields§
§status: u16§headers: HeaderMap§body: Vec<u8>Serialized response body — what gets returned to the client. Mutated by the rewrite and SSE-wrap middleware.
was_sse: boolTrue when the upstream sent SSE-wrapped JSON. SseUnwrapMiddleware sets it;
SseWrapMiddleware reads it to decide whether to re-wrap.
json: Option<Value>Parsed JSON view of the body. Populated by SseUnwrapMiddleware; mutated by
later middleware; serialized back into body by SseWrapMiddleware.
rpc_error: Option<(i64, String)>JSON-RPC error extracted from json (when present).
upstream_us: Option<u64>Implementations§
Auto Trait Implementations§
impl Freeze for ResponseContext
impl RefUnwindSafe for ResponseContext
impl Send for ResponseContext
impl Sync for ResponseContext
impl Unpin for ResponseContext
impl UnsafeUnpin for ResponseContext
impl UnwindSafe for ResponseContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more