From 10b1429d920777699c226e5ed4f1354c8d080aea Mon Sep 17 00:00:00 2001 From: Dan Sosedoff Date: Fri, 10 Oct 2014 20:39:44 -0500 Subject: [PATCH] Fix issue with format detection --- api.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/api.go b/api.go index 2c57349..d421cc0 100644 --- a/api.go +++ b/api.go @@ -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)