Plug v1.10.3 Plug.Parsers.JSON View Source

Parses JSON request body.

JSON documents that aren't maps (arrays, strings, numbers, etc) are parsed into a "_json" key to allow proper param merging.

An empty request body is parsed as an empty map.

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
  • :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.

Link to this section Summary

Link to this section Functions

Callback implementation for Plug.Parsers.init/1.

Link to this function

parse(conn, arg2, subtype, headers, arg5)

View Source

Callback implementation for Plug.Parsers.parse/5.