From 598c553c3fa9a8de1910ad629795cf9fa45b48da Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Thu, 9 Oct 2014 20:26:03 -0700 Subject: [PATCH] badge content-type was in wrong function --- server/handler/badge.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/handler/badge.go b/server/handler/badge.go index 3077061f..c228902c 100644 --- a/server/handler/badge.go +++ b/server/handler/badge.go @@ -36,6 +36,10 @@ func GetBadge(c web.C, w http.ResponseWriter, r *http.Request) { branch = c.URLParams["branch"] ) + // an SVG response is always served, even when error, so + // we can go ahead and set the content type appropriately. + w.Header().Set("Content-Type", "image/svg+xml") + repo, err := datastore.GetRepoName(ctx, host, owner, name) if err != nil { w.Write(badgeNone) @@ -82,8 +86,6 @@ func GetCC(c web.C, w http.ResponseWriter, r *http.Request) { name = c.URLParams["name"] ) - w.Header().Set("Content-Type", "image/svg+xml") - repo, err := datastore.GetRepoName(ctx, host, owner, name) if err != nil { w.Write(badgeNone)