Skip to content

Commit 2b0cfbe

Browse files
committed
Merge branch 'master' of https://github.com/labstack/echo
2 parents ecc01d2 + 608cebb commit 2b0cfbe

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

context.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ type (
2626
// SetRequest sets `*http.Request`.
2727
SetRequest(r *http.Request)
2828

29+
// SetResponse sets `*Response`.
30+
SetResponse(r *Response)
31+
2932
// Response returns `*Response`.
3033
Response() *Response
3134

@@ -228,6 +231,10 @@ func (c *context) Response() *Response {
228231
return c.response
229232
}
230233

234+
func (c *context) SetResponse(r *Response) {
235+
c.response = r
236+
}
237+
231238
func (c *context) IsTLS() bool {
232239
return c.request.TLS != nil
233240
}

echo.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,7 @@ func WrapMiddleware(m func(http.Handler) http.Handler) MiddlewareFunc {
771771
return func(c Context) (err error) {
772772
m(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
773773
c.SetRequest(r)
774+
c.SetResponse(NewResponse(w, c.Echo()))
774775
err = next(c)
775776
})).ServeHTTP(c.Response(), c.Request())
776777
return

0 commit comments

Comments
 (0)