Merge pull request #710 from jdeng/master

content type for getFile()
Этот коммит содержится в:
Joram Wilander
2015-09-22 14:08:32 -04:00
родитель e9a2c223f2 602bed85f2
Коммит a44e8f0cd9

Просмотреть файл

@@ -24,6 +24,7 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"math" "math"
"mime"
"net/http" "net/http"
"net/url" "net/url"
"os" "os"
@@ -424,7 +425,7 @@ func getFile(c *Context, w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "max-age=2592000, public") w.Header().Set("Cache-Control", "max-age=2592000, public")
w.Header().Set("Content-Length", strconv.Itoa(len(f))) w.Header().Set("Content-Length", strconv.Itoa(len(f)))
w.Header().Set("Content-Type", "") // need to provide proper Content-Type in the future w.Header().Set("Content-Type", mime.TypeByExtension(filepath.Ext(filename)))
w.Write(f) w.Write(f)
} }