I am using gin
as my http server and sending back an empty array in json as my response:
c.JSON(http.StatusOK, []string{})
The resulting json string I get is "[]
"
. The newline is added by the json Encoder object, see here.
Using goconvey
, I could test my json like
So(response.Body.String(), ShouldEqual, "[]
")
But is there a better way to generate the expected json string than just adding a newline to all of them?