FIX: json response for specific field endpoints

This commit is contained in:
Andrew Marcuse 2020-11-27 22:33:53 -05:00 committed by George Shammas
parent 4c19dda3a6
commit c82e3a5ff8
1 changed files with 5 additions and 1 deletions

View File

@ -154,7 +154,11 @@ func mainHandler(c *gin.Context) {
c.String(404, "Not Found")
return
}
c.String(200, fmt.Sprintln(fieldResult))
if wantsJSON {
c.JSON(200, fieldResult)
} else {
c.String(200, fmt.Sprintln(fieldResult))
}
}