Bier.Plugs.ReadBody (bier v0.1.0)

Copy Markdown View Source

Reads the full raw request body once, caching it in conn.assigns[:bier_raw_body], and JSON-parses it into conn.body_params when the request Content-Type is JSON.

PostgREST-style content negotiation needs the raw body for non-JSON request payloads (CSV inserts, octet-stream RPC) which Plug.Parsers would otherwise discard, while still decoding JSON bodies for the read/RPC paths. This plug replaces Plug.Parsers so a single read serves every content type.