1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 17:50:58 +00:00

Update output.go

This commit is contained in:
kbynd 2016-12-31 16:14:38 +05:30 committed by GitHub
parent 96387e9a9b
commit f0d1d7149b

View File

@ -67,8 +67,11 @@ func (output *BeegoOutput) Body(content []byte) error {
} }
if b, n, _ := WriteBody(encoding, buf, content); b { if b, n, _ := WriteBody(encoding, buf, content); b {
output.Header("Content-Encoding", n) output.Header("Content-Encoding", n)
} output.Header("Content-Length", strconv.Itoa(buf.Len()))
} else {
output.Header("Content-Length", strconv.Itoa(len(content))) output.Header("Content-Length", strconv.Itoa(len(content)))
}
// Write status code if it has been set manually // Write status code if it has been set manually
// Set it to 0 afterwards to prevent "multiple response.WriteHeader calls" // Set it to 0 afterwards to prevent "multiple response.WriteHeader calls"