mirror of
https://github.com/labstack/echo.git
synced 2024-12-28 21:08:39 +02:00
Merge branch 'master' of https://github.com/labstack/echo
This commit is contained in:
commit
2b0cfbe75d
@ -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
|
||||
}
|
||||
|
1
echo.go
1
echo.go
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user