Skip to main content

Module payload

Module payload 

Source
Expand description

RPC payload types with JSON/CBOR dual format support.

This module provides lightweight RPC request/response types and format negotiation based on HTTP headers:

  • Content-Type: application/cbor for CBOR request bodies
  • Content-Type: application/json (default) for JSON request bodies
  • Accept: application/cbor for CBOR responses
  • Accept: application/json (default) for JSON responses

Structs§

Accept
Extracts the preferred response format from the Accept header.
AppError
A typed error that converts to an HTTP response via IntoResponse.
AppResponse
A response type that supports both JSON and CBOR serialization.
HeaderVals
Extracts a bearer token from the Authorization header and sharding id from the X-Shard header.
PayloadFormat
Request/response format pair derived from HTTP content negotiation headers.
RpcError
RPC error object.
RpcRequest
RPC request object.
RpcResponse
RPC response object.

Enums§

ContentType
Content format for request/response payloads.
StringOr
A helper type that can represent either a raw string or a parsed value.