func BodyDumpWithConfig(config BodyDumpConfig) echo.MiddlewareFunc {
	if config.Handler == nil {
		panic("echo: body-dump middleware requires a handler function")
	}
	if config.Skipper == nil {
		config.Skipper = DefaultBodyDumpConfig.Skipper
	}
	return func(next echo.HandlerFunc) echo.HandlerFunc {
		return func(c echo.Context) (err error) {
			if config.Skipper(c) {
				return next(c)
			}
			reqBody := []byte{}
			if c.Request().Body != nil {  
				reqBody, _ = ioutil.ReadAll(c.Request().Body)
			}
			c.Request().Body = ioutil.NopCloser(bytes.NewBuffer(reqBody))  
			resBody := new(bytes.Buffer)
			mw := io.MultiWriter(c.Response().Writer, resBody)
			writer := &bodyDumpResponseWriter{Writer: mw, ResponseWriter: c.Response().Writer}
			c.Response().Writer = writer
			if err = next(c); err != nil {
				c.Error(err)
			}
			config.Handler(c, reqBody, resBody.Bytes())
			return
		}
	}
}
BodyDumpWithConfig returns a BodyDump middleware with config.
See: `BodyDump()`.
package middleware
import (
	"bufio"
	"bytes"
	"io"
	"io/ioutil"
	"net"
	"net/http"
	"github.com/labstack/echo"
)
type (
	BodyDumpConfig struct {
		Skipper Skipper
		Handler BodyDumpHandler
	}
	BodyDumpHandler func(echo.Context, []byte, []byte)
	bodyDumpResponseWriter struct {
		io.Writer
		http.ResponseWriter
	}
)
var (
	DefaultBodyDumpConfig = BodyDumpConfig{
		Skipper: DefaultSkipper,
	}
)
func BodyDump(handler BodyDumpHandler) echo.MiddlewareFunc {
	c := DefaultBodyDumpConfig
	c.Handler = handler
	return BodyDumpWithConfig(c)
}