Added relevant unit test.

This commit is contained in:
Josh Brandoff 2015-06-12 22:28:58 -04:00
parent 19bf52b5bd
commit 7d753188a7

View File

@ -219,6 +219,17 @@ func TestContextRenderJSON(t *testing.T) {
assert.Equal(t, w.HeaderMap.Get("Content-Type"), "application/json; charset=utf-8")
}
// Tests that the response is serialized as JSON
// and Content-Type is set to application/vnd.api+json
func TestContextRenderJSON(t *testing.T) {
c, w, _ := createTestContext()
c.JSONAPI(201, H{"foo": "bar"})
assert.Equal(t, w.Code, 201)
assert.Equal(t, w.Body.String(), "{\"foo\":\"bar\"}\n")
assert.Equal(t, w.HeaderMap.Get("Content-Type"), "application/vnd.api+json")
}
// Tests that the response is serialized as JSON
// and Content-Type is set to application/json
func TestContextRenderIndentedJSON(t *testing.T) {