Echo

Introduction


  • golang web framework

Note


rewrite response writer

type customResponseWriter struct {
	http.ResponseWriter
        ...
}

func (w customResponseWriter) Write(b []byte) (int, error) {
	return w.Write(...)
}

func (cfg *Config) responseHandler(next echo.HandlerFunc) echo.HandlerFunc {
	return func(c echo.Context) error {
		newWriter := &customResponseWriter{c.Response().Writer}
		c.Response().Writer = newWriter

		return next(c)
	}
}