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() q := c.Request.URL.Query()
format := q["format"][0] if len(q["format"]) > 0 {
if format == "" { if q["format"][0] == "csv" {
format = "json" c.String(200, result.CSV())
} return
}
if format == "csv" {
c.String(200, result.CSV())
return
} }
c.JSON(200, result) c.JSON(200, result)