I use ginas my http server and send an empty array to json as an answer:
c.JSON(http.StatusOK, []string{})
The resulting json string I get is equal to "[]\n". A new line has been added by the json Encoder object, see here .
Using goconvey, I could check my json as
So(response.Body.String(), ShouldEqual, "[]\n")
But is there a better way to generate the expected json string than just adding a new string to all of them?
Derek source
share