mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 13:10:54 +00:00
EnableGZip=true,then content-length header missing
This results in responses with Content-Type as gzip as opposed to original content type. This affects ServeJSON() function.
This commit is contained in:
parent
90999717dd
commit
96387e9a9b
@ -67,9 +67,9 @@ 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)
|
||||||
} 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"
|
||||||
if output.Status != 0 {
|
if output.Status != 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user