Plug v1.7.1 Plug.Parsers.URLENCODED
Parses urlencoded request body.
Options
All options supported by Plug.Conn.read_body/2
are also supported here. They are repeated here for convenience:
-
:length
- sets the maximum number of bytes to read from the request, defaults to 1_000_000 bytes -
:read_length
- sets the amount of bytes to read at one time from the underlying socket to fill the chunk, defaults to 1_000_000 bytes -
:read_timeout
- sets the timeout for each socket read, defaults to 15_000ms
So by default, Plug.Parsers
will read 1_000_000 bytes at a time from the socket with an overall limit of 8_000_000 bytes.
Summary
Functions
- init(opts)
-
Callback implementation for
Plug.Parsers.init/1
- parse(conn, arg2, arg3, headers, arg5)
-
Attempts to parse the connection’s request body given the content-type type, subtype, and its parameters
Functions
Callback implementation for Plug.Parsers.init/1
.
Attempts to parse the connection’s request body given the content-type type, subtype, and its parameters.
The arguments are:
- the
Plug.Conn
connection -
type
, the content-type type (e.g.,"x-sample"
for the"x-sample/json"
content-type) -
subtype
, the content-type subtype (e.g.,"json"
for the"x-sample/json"
content-type) -
params
, the content-type parameters (e.g.,%{"foo" => "bar"}
for the"text/plain; foo=bar"
content-type)
This function should return:
-
{:ok, body_params, conn}
if the parser is able to handle the given content-type;body_params
should be a map -
{:next, conn}
if the next parser should be invoked -
{:error, :too_large, conn}
if the request goes over the given limit
Callback implementation for Plug.Parsers.parse/5
.
© 2013 Plataformatec
Licensed under the Apache License, Version 2.0.
https://hexdocs.pm/plug/1.7.1/Plug.Parsers.URLENCODED.html