Representing the state of the connection with the Plug.Conn struct
Plug uses the Plug.Conn struct to represent the state of a connection at a point in time. This includes information related to the request, cookies, response, and status codes.
This struct fits well into the philosophy of using plugs, which involves using a plug in a functional way to transform the attributes of a Plug.Conn struct. This also means that a plug receives a Plug.Conn with a state denoting that the response has already been set or that the connection was halted; this plug ignores that connection.
Some of the other useful information that Plug.Conn tracks are as follows:
req_headers: Represents the downcased version of request headers. This is super helpful for operations such as authentication or caching.params: Denotes merged map parameters sent as path params and body params.cookies: Request and response cookies.status: Response status.assigns: A place to store user data...