summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/markdown/markdown.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp/markdown/markdown.go')
-rw-r--r--modules/caddyhttp/markdown/markdown.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/caddyhttp/markdown/markdown.go b/modules/caddyhttp/markdown/markdown.go
index 122aad6..5ff18b8 100644
--- a/modules/caddyhttp/markdown/markdown.go
+++ b/modules/caddyhttp/markdown/markdown.go
@@ -48,8 +48,8 @@ func (m Markdown) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyht
buf.Reset()
defer bufPool.Put(buf)
- shouldBuf := func(status int) bool {
- return strings.HasPrefix(w.Header().Get("Content-Type"), "text/")
+ shouldBuf := func(status int, header http.Header) bool {
+ return strings.HasPrefix(header.Get("Content-Type"), "text/")
}
rec := caddyhttp.NewResponseRecorder(w, buf, shouldBuf)
@@ -62,6 +62,8 @@ func (m Markdown) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyht
return nil
}
+ caddyhttp.CopyHeader(w.Header(), rec.Header())
+
output := blackfriday.Run(buf.Bytes())
w.Header().Set("Content-Length", strconv.Itoa(len(output)))