diff options
Diffstat (limited to 'vendor/github.com/labstack/echo/v4/context.go')
-rw-r--r-- | vendor/github.com/labstack/echo/v4/context.go | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/vendor/github.com/labstack/echo/v4/context.go b/vendor/github.com/labstack/echo/v4/context.go index e0f4cc00..27da5ffe 100644 --- a/vendor/github.com/labstack/echo/v4/context.go +++ b/vendor/github.com/labstack/echo/v4/context.go @@ -183,6 +183,9 @@ type ( // Logger returns the `Logger` instance. Logger() Logger + // Set the logger + SetLogger(l Logger) + // Echo returns the `Echo` instance. Echo() *Echo @@ -202,6 +205,7 @@ type ( handler HandlerFunc store Map echo *Echo + logger Logger lock sync.RWMutex } ) @@ -347,7 +351,8 @@ func (c *context) FormParams() (url.Values, error) { } func (c *context) FormFile(name string) (*multipart.FileHeader, error) { - _, fh, err := c.request.FormFile(name) + f, fh, err := c.request.FormFile(name) + defer f.Close() return fh, err } @@ -597,9 +602,17 @@ func (c *context) SetHandler(h HandlerFunc) { } func (c *context) Logger() Logger { + res := c.logger + if res != nil { + return res + } return c.echo.Logger } +func (c *context) SetLogger(l Logger) { + c.logger = l +} + func (c *context) Reset(r *http.Request, w http.ResponseWriter) { c.request = r c.response.reset(w) @@ -608,6 +621,9 @@ func (c *context) Reset(r *http.Request, w http.ResponseWriter) { c.store = nil c.path = "" c.pnames = nil + c.logger = nil // NOTE: Don't reset because it has to have length c.echo.maxParam at all times - // c.pvalues = nil + for i := 0; i < *c.echo.maxParam; i++ { + c.pvalues[i] = "" + } } |