summaryrefslogtreecommitdiffstats
path: root/api/file.go
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2015-07-29 10:21:31 -0400
committerhmhealey <harrisonmhealey@gmail.com>2015-07-29 10:21:31 -0400
commit2e5528542d532adb81b038cf14c0bae696fec03a (patch)
tree29b99a0091e8602a1432dbfa2484b827a7738619 /api/file.go
parentde01a7e6797a0d5c73bccc709639ff4ba328b744 (diff)
downloadchat-2e5528542d532adb81b038cf14c0bae696fec03a.tar.gz
chat-2e5528542d532adb81b038cf14c0bae696fec03a.tar.bz2
chat-2e5528542d532adb81b038cf14c0bae696fec03a.zip
Changed file API to not write response data on a HEAD request
Diffstat (limited to 'api/file.go')
-rw-r--r--api/file.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/api/file.go b/api/file.go
index 123cab457..219cf6103 100644
--- a/api/file.go
+++ b/api/file.go
@@ -261,7 +261,10 @@ func getFile(c *Context, w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "max-age=2592000, public")
w.Header().Set("Content-Length", strconv.Itoa(len(f)))
- w.Write(f)
+
+ if r.Method != "HEAD" {
+ w.Write(f)
+ }
}
func asyncGetFile(path string, fileData chan []byte) {