Find file Copy path
e0c45e3 Aug 15, 2017
2 contributors

Users who have contributed to this file

@vishr @aaharu
48 lines (36 sloc) 1021 Bytes

+++ title = "Body Dump Middleware" description = "Body dump middleware for Echo" [menu.main] name = "Body Dump" parent = "middleware" +++

Body dump middleware captures the request and response payload and calls the registered handler. Generally used for debugging/logging purpose. Avoid using it if your request/response payload is huge e.g. file upload/download, but if you still need to, add an exception for your endpoints in the skipper function.


e := echo.New()
e.Use(middleware.BodyDump(func(c echo.Context, reqBody, resBody []byte) {

Custom Configuration


e := echo.New()


BodyDumpConfig struct {
  // Skipper defines a function to skip middleware.
  Skipper Skipper

  // Handler receives request and response payload.
  // Required.
  Handler BodyDumpHandler

Default Configuration

DefaultBodyDumpConfig = BodyDumpConfig{
  Skipper: DefaultSkipper,