plug_protobufs v0.1.1 Plug.Parsers.Protobuf

Parses a Protobuf request body.

The router definition must set a private: MyProtobuf field so that we know which protobuf definition to use to parse the protobuf.

Link to this section Summary

Functions

Attempts to parse the connection’s request body given the content-type type, subtype, and its parameters

Link to this section Functions

Link to this function parse(conn, arg2, subtype, headers, opts)

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.