Plug.Parsers.MULTIPART

Plug.Parsers.MULTIPART

Parses multipart request body.

Besides the options supported by Plug.Conn.read_body/2, the multipart parser also checks for :headers option that contains the same :length, :read_length and :read_timeout options which are used explicitly for parsing multipart headers.

Summary

Functions

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

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

Functions

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.

© 2013 Plataformatec
Licensed under the Apache License, Version 2.0.
https://hexdocs.pm/plug/Plug.Parsers.MULTIPART.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部