Nested pipelines? Or other way to ensure that code runs after every request

Is there a way to have a Plug run AFTER every request, and operate on the outbound Conn data?

Specifically, I’m wanting to populate the Conn with some custom data during every request and then be able to extract that data after the request to do some custom logging of metadata about the request.

Was thinking that a nested pipeline might do it, but I haven’t found any documentation that leads me to believe that that is possible.

Thanks – Michael W


Sounds like you are looking for Plug.Conn.register_before_send/2


Many thanks, Chris!

I hope to see you next week at Lonestar ElixirConf.


1 Like