Fix issue with format detection

This commit is contained in:
Dan Sosedoff 2014-10-10 20:39:44 -05:00
parent 1dbeddbd5d
commit 10b1429d92

13
api.go
View File

@ -70,14 +70,11 @@ func API_HandleQuery(query string, c *gin.Context) {
q := c.Request.URL.Query()
format := q["format"][0]
if format == "" {
format = "json"
}
if format == "csv" {
c.String(200, result.CSV())
return
if len(q["format"]) > 0 {
if q["format"][0] == "csv" {
c.String(200, result.CSV())
return
}
}
c.JSON(200, result)