class HTTP::Request

Overview

Extensions to the standard HTTP::Request class.

Defined in:

onyx-http/ext/http/request.cr
onyx-http/ext/http/request/accept.cr
onyx-http/ext/http/request/id.cr
onyx-http/ext/http/request/path_params.cr

Instance Method Summary

Instance Method Detail

def accept : Array(MIME::MediaType)? #

An lazy array of MIME::MediaType this request accepts determined by the "Accept" header or nil if it is empty. The array is sorted by the q-factor.


[View source]
def id : String? #

A request ID. Can be set by Onyx::REST::RequestID.


[View source]
def id=(id : String?) #

A request ID. Can be set by Onyx::REST::RequestID.


[View source]
def path_params : Hash(String, String) #

A hash containing path params (extracted from the request's path). It's automatically set when routing with Onyx::REST::Router, empty by default.

For example, request with path "/user/42/edit" is routed with put "/user/:id/edit" will have {"id" => "42"} path params.

NOTE You must not modify this hash values directly (e.g. req.path_params["foo"] = "bar").

TODO Make this hash immutable.


[View source]
def path_params=(path_params : Hash(String, String)) #

A hash containing path params (extracted from the request's path). It's automatically set when routing with Onyx::REST::Router, empty by default.

For example, request with path "/user/42/edit" is routed with put "/user/:id/edit" will have {"id" => "42"} path params.

NOTE You must not modify this hash values directly (e.g. req.path_params["foo"] = "bar").

TODO Make this hash immutable.


[View source]