Expand description
HTTP boundary types for lenient JSON-RPC parsing
These types are designed for parsing JSON-RPC messages at HTTP boundaries where the input may not be strictly compliant. They accept any valid JSON structure and can be converted to the canonical types after validation.
§Usage
use turbomcp_protocol::jsonrpc::http::{HttpJsonRpcRequest, HttpJsonRpcResponse};
use turbomcp_protocol::jsonrpc::JsonRpcError;
// Parse lenient request
let raw_json = r#"{"jsonrpc":"2.0","method":"test","id":1}"#;
let request: HttpJsonRpcRequest = serde_json::from_str(raw_json).unwrap();
// Validate and use
if request.jsonrpc != "2.0" {
// Return error with the id we managed to extract
}Structs§
- Http
Json RpcRequest - Lenient JSON-RPC request for HTTP boundary parsing
- Http
Json RpcResponse - Lenient JSON-RPC response for HTTP boundary