diff --git a/evo.context.go b/evo.context.go index 18125e7e..ce4b02b6 100644 --- a/evo.context.go +++ b/evo.context.go @@ -27,7 +27,7 @@ type Request struct { CacheDuration time.Duration Debug bool flashes []flash - BeforeWrite func(request *Request) + BeforeWrite func(request *Request, body []byte) []byte } type flash struct { Type string `json:"type"` diff --git a/fiber.context.go b/fiber.context.go index 03397ce3..4c3b21c4 100644 --- a/fiber.context.go +++ b/fiber.context.go @@ -477,7 +477,7 @@ func (r *Request) Write(body interface{}) { }, r.CacheDuration) } if r.BeforeWrite != nil { - r.BeforeWrite(r) + data = r.BeforeWrite(r, data) } r.Context.Context().Response.SetBody(data) }