Skip to content

Commit

Permalink
before write to output
Browse files Browse the repository at this point in the history
  • Loading branch information
iesreza committed Oct 19, 2022
1 parent 3c48bb8 commit 935e137
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions evo.context.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type Request struct {
CacheDuration time.Duration
Debug bool
flashes []flash
BeforeWrite func(request *Request)
}
type flash struct {
Type string `json:"type"`
Expand Down
3 changes: 3 additions & 0 deletions fiber.context.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,9 @@ func (r *Request) Write(body interface{}) {
code: r.Context.Context().Response.StatusCode(),
}, r.CacheDuration)
}
if r.BeforeWrite != nil {
r.BeforeWrite(r)
}
r.Context.Context().Response.SetBody(data)
}

Expand Down

0 comments on commit 935e137

Please sign in to comment.