Body Dump 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.

Usage

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

Custom Configuration

Usage

  1. e := echo.New()
  2. e.Use(middleware.BodyDumpWithConfig(middleware.BodyDumpConfig{}))

Configuration

  1. BodyDumpConfig struct {
  2. // Skipper defines a function to skip middleware.
  3. Skipper Skipper
  4. // Handler receives request and response payload.
  5. // Required.
  6. Handler BodyDumpHandler
  7. }

Default Configuration

  1. DefaultBodyDumpConfig = BodyDumpConfig{
  2. Skipper: DefaultSkipper,
  3. }