less_verifies_alexa v0.1.0 Plug.Parsers.ALEXAJSON

Parses JSON request body as passed by Alexa. We roll our own parser because we need to keep a copy of the request body to validate the request.

JSON arrays are parsed into a "_json" key to allow proper param merging.

An empty request body is parsed as an empty map.

Summary

Functions

Attempts to parse the connection’s request body given the content-type type and subtype and the headers

Functions

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

Attempts to parse the connection’s request body given the content-type type and subtype and the headers.

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)
  • opts, the list of options passed to the Plug.Parsers plug

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.