Fix issue with format detection
This commit is contained in:
parent
1dbeddbd5d
commit
10b1429d92
9
api.go
9
api.go
@ -70,15 +70,12 @@ func API_HandleQuery(query string, c *gin.Context) {
|
||||
|
||||
q := c.Request.URL.Query()
|
||||
|
||||
format := q["format"][0]
|
||||
if format == "" {
|
||||
format = "json"
|
||||
}
|
||||
|
||||
if format == "csv" {
|
||||
if len(q["format"]) > 0 {
|
||||
if q["format"][0] == "csv" {
|
||||
c.String(200, result.CSV())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
c.JSON(200, result)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user