I would like to know how can we display the http response (header and body) built by Phoenix right before it is sent to the client.
You can’t, as the first byte might have already been sent before the last one is calculated, as
conn is basically a sink you stream into.
Really ? well, right after would work as well. Basically I would like a log of what has been sent to the client.
:plug doesn’t support that as well as far as I know.
What about “outside” phoenix? Google for “nginx lua log response body” if this is of any help… If you’re on production you may want to use a filter and not log every request…
Wasn’t my question, but I didn’t knew that one, so I suggested a possible solution until a better one appeared. register_before_send looks good. So tnx, I’m sure that I will need this one day!