1
0
mirror of https://github.com/labstack/echo.git synced 2025-02-03 13:11:39 +02:00
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2016-03-12 09:30:05 -08:00
parent 082814c776
commit a7697fe480

View File

@ -340,11 +340,7 @@ func (c *context) Object() *context {
func ServeContent(req engine.Request, res engine.Response, f http.File, fi os.FileInfo) error {
// TODO: http.ServeContent(c.Response(), c.Request(), fi.Name(), fi.ModTime(), f)
ct := mime.TypeByExtension(filepath.Ext(fi.Name()))
if ct == "" {
ct = OctetStream
}
req.Header().Set(ContentType, ct)
res.Header().Set(ContentType, detectContentType(fi.Name()))
res.WriteHeader(http.StatusOK)
_, err := io.Copy(res, f)
return err