Spikard.Conn (spikard v0.16.0-rc.3)

Copy Markdown

HTTP request context passed to handlers.

Contains path parameters, query parameters, headers, cookies, and body data. Handlers receive this struct as the single argument and use it to access request data.

Summary

Types

t()

HTTP request context.

Functions

Get a cookie value.

Get a header value.

Get a path parameter value.

Get a query parameter value.

Types

t()

@type t() :: %Spikard.Conn{
  body: any(),
  cookies: map(),
  headers: map(),
  method: String.t(),
  path: String.t(),
  path_params: map(),
  query_params: map(),
  raw_body: binary() | nil
}

HTTP request context.

Fields:

  • path_params: Map of path parameters extracted from the URL
  • query_params: Map of query parameters
  • headers: Map of HTTP headers
  • cookies: Map of HTTP cookies
  • body: Parsed request body (JSON or other format)
  • raw_body: Raw request body bytes
  • method: HTTP method (GET, POST, etc.)
  • path: Request path

Functions

cookie(conn, name)

Get a cookie value.

header(conn, name)

Get a header value.

path_param(conn, name)

Get a path parameter value.

query_param(conn, name)

Get a query parameter value.