Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/labstack/echo
Browse files Browse the repository at this point in the history
  • Loading branch information
vishr committed Aug 11, 2019
2 parents ecc01d2 + 608cebb commit 2b0cfbe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ type (
// SetRequest sets `*http.Request`.
SetRequest(r *http.Request)

// SetResponse sets `*Response`.
SetResponse(r *Response)

// Response returns `*Response`.
Response() *Response

Expand Down Expand Up @@ -228,6 +231,10 @@ func (c *context) Response() *Response {
return c.response
}

func (c *context) SetResponse(r *Response) {
c.response = r
}

func (c *context) IsTLS() bool {
return c.request.TLS != nil
}
Expand Down
1 change: 1 addition & 0 deletions echo.go
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,7 @@ func WrapMiddleware(m func(http.Handler) http.Handler) MiddlewareFunc {
return func(c Context) (err error) {
m(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
c.SetRequest(r)
c.SetResponse(NewResponse(w, c.Echo()))
err = next(c)
})).ServeHTTP(c.Response(), c.Request())
return
Expand Down

0 comments on commit 2b0cfbe

Please sign in to comment.