Sake.Plug.Headers (Sake v0.1.0)

Copy Markdown View Source

The request headers that mirror the body on the modern Streamable HTTP transport: Mcp-Method, Mcp-Name and Mcp-Param-*, with the Base64 sentinel encoding for values that are not plain ASCII.

Summary

Functions

Encodes a string, integer or boolean for a header.

Checks the mirrored headers of a modern request against the body.

Functions

decode_value(v)

@spec decode_value(String.t()) :: {:ok, String.t()} | :error

encode_value(v)

@spec encode_value(String.t() | integer() | boolean()) :: String.t()

Encodes a string, integer or boolean for a header.

validate(conn, arg2, spec)

@spec validate(Plug.Conn.t(), Sake.JSONRPC.parsed(), Sake.Tool.Spec.t() | nil) ::
  :ok | {:error, String.t()}

Checks the mirrored headers of a modern request against the body.