Make badgeNone usable in HTML img tag (returning 200 instead of 404)

Also adds a print in the log about the kind of failure
This commit is contained in:
Sandro Santilli 2016-07-12 12:53:01 +02:00
parent 35e5435400
commit 578f73c791

View file

@ -2,6 +2,7 @@ package server
import (
"fmt"
"log"
"github.com/gin-gonic/gin"
@ -42,7 +43,8 @@ func GetBadge(c *gin.Context) {
build, err := store.GetBuildLast(c, repo, branch)
if err != nil {
c.String(404, badgeNone)
log.Println(err)
c.String(200, badgeNone)
return
}
@ -56,7 +58,7 @@ func GetBadge(c *gin.Context) {
case model.StatusPending, model.StatusRunning:
c.String(200, badgeStarted)
default:
c.String(404, badgeNone)
c.String(200, badgeNone)
}
}