From 96387e9a9b9e30824637c7a153311c51cc9cbc07 Mon Sep 17 00:00:00 2001 From: kbynd Date: Sat, 31 Dec 2016 16:04:34 +0530 Subject: [PATCH] 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. --- context/output.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/context/output.go b/context/output.go index c09b9d19..7b238ab8 100644 --- a/context/output.go +++ b/context/output.go @@ -67,9 +67,9 @@ func (output *BeegoOutput) Body(content []byte) error { } if b, n, _ := WriteBody(encoding, buf, content); b { 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 // Set it to 0 afterwards to prevent "multiple response.WriteHeader calls" if output.Status != 0 {