Documentation
¶
Overview ¶
Package dispatch is the pure-Go, CGO-free analogue of ActionDispatch's HTTP layer: a Request and Response wrapping the reused go-ruby-rack primitives, augmented with routing path parameters, a merged strong-parameters view, and content-type format negotiation.
Index ¶
- type Request
- func (r *Request) ActionName() string
- func (r *Request) ControllerName() string
- func (r *Request) Format() string
- func (r *Request) Parameters() (*parameters.Parameters, error)
- func (r *Request) PathParameters() map[string]any
- func (r *Request) QueryParameters() (map[string]any, error)
- func (r *Request) RequestParameters() (map[string]any, error)
- func (r *Request) SetPathParameters(p map[string]any)
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Request ¶
Request wraps a rack.Request, adding the path parameters produced by routing and the ActionController parameter/format accessors.
func NewRequest ¶
NewRequest builds a dispatch Request over a Rack environment.
func (*Request) ActionName ¶
ActionName returns the action resolved by routing, or "".
func (*Request) ControllerName ¶
ControllerName returns the controller resolved by routing, or "".
func (*Request) Format ¶
Format returns the response format symbol negotiated for the request: the routing ":format" segment when present, otherwise the first recognised media type of the Accept header, defaulting to "html".
func (*Request) Parameters ¶
func (r *Request) Parameters() (*parameters.Parameters, error)
Parameters returns the merged strong-parameters view: query parameters, overlaid by request-body parameters, overlaid by routing path parameters, exactly matching the precedence of ActionController's params.
func (*Request) PathParameters ¶
PathParameters returns a copy of the routing path parameters.
func (*Request) QueryParameters ¶
QueryParameters returns the parsed query-string parameters as a plain map.
func (*Request) RequestParameters ¶
RequestParameters returns the parsed POST/body parameters as a plain map.
func (*Request) SetPathParameters ¶
SetPathParameters stores the parameters recognized by the router (controller, action, and dynamic segments).
type Response ¶
Response wraps a rack.Response with ActionController conveniences. It starts as an empty 200 response; the embedded *rack.Response promotes Write, Status, SetStatus, Headers, SetContentType, SetLocation, and the rest of the Rack response API.
func (*Response) BodyString ¶
BodyString returns the response body joined into a single string.