Undocumented limitation on BodyDumpConfig Skipper in BodyDump middleware
Issue Description
Documentation suggests using the skipper function to skip over large response bodies. However, it is not obvious that the skipper function runs before the route handler, which makes it rather useless in a lot of common cases. In particular, it is useless if I want to skip the middleware for a specific content type (e.g. binary download), as the header will be set after the skipper runs.
The solution is very simple -- don't use the skipper function and put the skipping logic in the body dump handler. It would be nice if the documentation mentioned that.
Version/commit
Echo 4.5
I would assume that part in docs was referring to cases when you know body to be not worthy to be logged. ala you want to log usual API endpoints but exclude certain binary download paths.
If someone has better wording for that, please do PR against that file https://github.com/labstack/echox/blob/master/website/content/middleware/body-dump.md in Echox repository
closing at the moment.
-
BodyDumpConfig.Skipperallows user to skip reading request/response body to memory altogether. -
BodyDumpConfig.Handlertakes in echo.Context, request body, response body so user can decide onc.Response()values if req/res needs to be dumped.