module
Amber::Router::Parsers::FormData
Defined in:
amber/router/parsers/form_data.crClass Method Summary
-
.parse(request : HTTP::Request, budget : ParamBudget = request.param_budget) : HTTP::Params
Parses a URL-encoded request body, checking each pair as it streams and charging budget (the request's own budget by default).
- .parse_part(input : IO, limits : Amber::Configuration::ParamsConfig = Amber.settings.params) : HTTP::Params
- .parse_part(input : String, limits : Amber::Configuration::ParamsConfig = Amber.settings.params) : HTTP::Params
- .parse_part(input : Nil, limits : Amber::Configuration::ParamsConfig = Amber.settings.params) : HTTP::Params
Class Method Detail
Parses a URL-encoded request body, checking each pair as it streams and charging budget (the request's own budget by default).
A charset declared in the Content-Type is decoded to UTF-8 while
the body streams, as HTTP::Request#form_params does in Crystal.
Amber parses the form before the action runs (the CSRF pipe reads
_csrf from params), which drains the body. The bytes the parse
reads are kept and put back into request.body, so the action reads
exactly what the client sent. The parse never reads more than
max_form_body_bytes, which bounds the kept copy; a body whose
declared Content-Length is already over that limit is rejected
without keeping anything.