From f0d1d7149bfc2e4618cf5a388f795c901d9c74d0 Mon Sep 17 00:00:00 2001 From: kbynd Date: Sat, 31 Dec 2016 16:14:38 +0530 Subject: [PATCH] Update output.go --- context/output.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/context/output.go b/context/output.go index 7b238ab8..76b523d3 100644 --- a/context/output.go +++ b/context/output.go @@ -67,8 +67,11 @@ func (output *BeegoOutput) Body(content []byte) error { } if b, n, _ := WriteBody(encoding, buf, content); b { output.Header("Content-Encoding", n) - } - output.Header("Content-Length", strconv.Itoa(len(content))) + output.Header("Content-Length", strconv.Itoa(buf.Len())) + } else { + 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"