FIX: json response for specific field endpoints

This commit is contained in:
Andrew Marcuse
2020-11-28 09:09:29 -05:00
committed by George Shammas
parent 4c19dda3a6
commit c82e3a5ff8
+5 -1
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))
}
}