Fix issue with format detection
This commit is contained in:
parent
1dbeddbd5d
commit
10b1429d92
13
api.go
13
api.go
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user