From 6025a4a41c72c64db7d367b68dd2a8019bcddf97 Mon Sep 17 00:00:00 2001 From: Jerry Jacobs Date: Sat, 7 Oct 2017 01:21:41 +0200 Subject: [PATCH] Allow overwrite of ContentType by caller of RequestCtx.ServeFile --- fs.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs.go b/fs.go index ff4d5ac..7314062 100644 --- a/fs.go +++ b/fs.go @@ -823,7 +823,9 @@ func (h *fsHandler) handleRequest(ctx *RequestCtx) { } } } - ctx.SetContentType(ff.contentType) + if len(ctx.Response.Header.ContentType()) == 0 { + ctx.SetContentType(ff.contentType) + } ctx.SetStatusCode(statusCode) }