Plug v1.10.3 Plug.Parsers.MULTIPART View Source
Parses multipart 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 8_000_000 bytes. UnlikePlug.Conn.read_body/2
supports passing an MFA ({module, function, args}
) which will be evaluated on every request to determine the value.: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.
Besides the options supported by Plug.Conn.read_body/2
, the multipart parser
also checks for:
:headers
- containing the same:length
,:read_length
and:read_timeout
options which are used explicitly for parsing multipart headers.:include_unnamed_parts_at
- string specifying a body parameter that can hold a lists of body parts that didn't have a 'Content-Disposition' header. For instance,include_unnamed_parts_at: "_parts"
would result in a body parameter"_parts"
, containing a list of parts, each with:body
and:headers
fields, like[%{body: "{}", headers: [{"content-type", "application/json"}]}]
.:validate_utf8
- specifies whether multipart body parts should be validated as utf8 binaries. Defaults to true.
Link to this section Summary
Functions
Callback implementation for Plug.Parsers.init/1
.
Callback implementation for Plug.Parsers.parse/5
.
Link to this section Functions
Callback implementation for Plug.Parsers.init/1
.
Callback implementation for Plug.Parsers.parse/5
.