Exploring Plug: The Body Reader

Ever wondered why sometimes Plug.Conn.read_body/2 returns nil instead of returning the raw body of the request? Today we’ll examine why this happens and how to elegantly get around it. Plug crash course Before exploring why this happens, let’s take a step back and take a naive look on how Plug works. In its most basic sense, a plug is a transformation applied to a connection; a plug can be either a function, or a module that receives information about a request in the form of %Plug....

November 14, 2018