diff options
author | Wim <wim@42.be> | 2022-03-12 19:41:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-12 19:41:07 +0100 |
commit | b3be2e208cb373207d6199cac5a9fc92be073e7a (patch) | |
tree | 6de6d444737edee8f0476eea87c233fa980f0002 /vendor/github.com/labstack/echo/v4/context.go | |
parent | c30e90ff3f7e9ff96ac79ed4b7d90d6346216a15 (diff) | |
download | matterbridge-msglm-b3be2e208cb373207d6199cac5a9fc92be073e7a.tar.gz matterbridge-msglm-b3be2e208cb373207d6199cac5a9fc92be073e7a.tar.bz2 matterbridge-msglm-b3be2e208cb373207d6199cac5a9fc92be073e7a.zip |
Update dependencies and vendor (#1761)
Diffstat (limited to 'vendor/github.com/labstack/echo/v4/context.go')
-rw-r--r-- | vendor/github.com/labstack/echo/v4/context.go | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/vendor/github.com/labstack/echo/v4/context.go b/vendor/github.com/labstack/echo/v4/context.go index 91ab6e48..a4ecfadf 100644 --- a/vendor/github.com/labstack/echo/v4/context.go +++ b/vendor/github.com/labstack/echo/v4/context.go @@ -9,8 +9,6 @@ import ( "net" "net/http" "net/url" - "os" - "path/filepath" "strings" "sync" ) @@ -211,6 +209,13 @@ type ( ) const ( + // ContextKeyHeaderAllow is set by Router for getting value for `Allow` header in later stages of handler call chain. + // Allow header is mandatory for status 405 (method not found) and useful for OPTIONS method requests. + // It is added to context only when Router does not find matching method handler for request. + ContextKeyHeaderAllow = "echo_header_allow" +) + +const ( defaultMemory = 32 << 20 // 32 MB indexPage = "index.html" defaultIndent = " " @@ -562,29 +567,6 @@ func (c *context) Stream(code int, contentType string, r io.Reader) (err error) return } -func (c *context) File(file string) (err error) { - f, err := os.Open(file) - if err != nil { - return NotFoundHandler(c) - } - defer f.Close() - - fi, _ := f.Stat() - if fi.IsDir() { - file = filepath.Join(file, indexPage) - f, err = os.Open(file) - if err != nil { - return NotFoundHandler(c) - } - defer f.Close() - if fi, err = f.Stat(); err != nil { - return - } - } - http.ServeContent(c.Response(), c.Request(), fi.Name(), fi.ModTime(), f) - return -} - func (c *context) Attachment(file, name string) error { return c.contentDisposition(file, name, "attachment") } |