Skip to content

Commit

Permalink
Also test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
kegsay committed Feb 21, 2017
1 parent 75ee6d4 commit 77c8839
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions json_test.go
Expand Up @@ -35,6 +35,10 @@ func TestMakeJSONAPI(t *testing.T) {
{nil, &HTTPError{nil, "Everything is broken", 500, struct {
Foo string `json:"foo"`
}{"yep"}}, 500, `{"foo":"yep"}`},
// Error JSON return values which fail to be marshalled should fallback to text
{nil, &HTTPError{nil, "Everything is broken", 500, struct {
Foo interface{} `json:"foo"`
}{func(cannotBe, marshalled string) {}}}, 500, `{"message":"Everything is broken"}`},
// With different status codes
{nil, &HTTPError{nil, "Not here", 404, nil}, 404, `{"message":"Not here"}`},
// Success return values
Expand Down

0 comments on commit 77c8839

Please sign in to comment.