1
0
mirror of https://github.com/labstack/echo.git synced 2025-12-01 22:51:17 +02:00

Assign new ResponseWriter after calling http.HandlerFunc (#1341)

Otherwise, the `http.ResponseWriter` passed to `next()` within the
middleware is unused. This precludes middlewares from wrapping the
http.ResponseWriter to do things like record the status code.
This commit is contained in:
Jesse Szwedko
2019-08-07 14:10:18 -04:00
committed by Vishal Rana
parent 09d415cefc
commit 608cebbaae
2 changed files with 8 additions and 0 deletions

View File

@@ -26,6 +26,9 @@ type (
// SetRequest sets `*http.Request`.
SetRequest(r *http.Request)
// SetResponse sets `*Response`.
SetResponse(r *Response)
// Response returns `*Response`.
Response() *Response
@@ -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
}