diff --git a/context_test.go b/context_test.go
index 32e596e..81e1884 100644
--- a/context_test.go
+++ b/context_test.go
@@ -358,9 +358,9 @@ func TestContextRenderJSON(t *testing.T) {
c.JSON(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/json; charset=utf-8")
+ assert.Equal(t, 201, w.Code)
+ assert.Equal(t, "{\"foo\":\"bar\"}", w.Body.String())
+ assert.Equal(t, "application/json; charset=utf-8", w.HeaderMap.Get("Content-Type"))
}
// Tests that the response is serialized as JSON
@@ -372,9 +372,9 @@ func TestContextRenderAPIJSON(t *testing.T) {
c.Header("Content-Type", "application/vnd.api+json")
c.JSON(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")
+ assert.Equal(t, 201, w.Code)
+ assert.Equal(t, "{\"foo\":\"bar\"}", w.Body.String())
+ assert.Equal(t, "application/vnd.api+json", w.HeaderMap.Get("Content-Type"))
}
// Tests that the response is serialized as JSON
diff --git a/logger_test.go b/logger_test.go
index 2ad1f47..7c064c9 100644
--- a/logger_test.go
+++ b/logger_test.go
@@ -107,16 +107,16 @@ func TestErrorLogger(t *testing.T) {
})
w := performRequest(router, "GET", "/error")
- assert.Equal(t, w.Code, 200)
- assert.Equal(t, w.Body.String(), "{\"error\":\"this is an error\"}\n")
+ assert.Equal(t, 200, w.Code)
+ assert.Equal(t, "{\"error\":\"this is an error\"}", w.Body.String())
w = performRequest(router, "GET", "/abort")
- assert.Equal(t, w.Code, 401)
- assert.Equal(t, w.Body.String(), "{\"error\":\"no authorized\"}\n")
+ assert.Equal(t, 401, w.Code)
+ assert.Equal(t, "{\"error\":\"no authorized\"}", w.Body.String())
w = performRequest(router, "GET", "/print")
- assert.Equal(t, w.Code, 500)
- assert.Equal(t, w.Body.String(), "hola!{\"error\":\"this is an error\"}\n")
+ assert.Equal(t, 500, w.Code)
+ assert.Equal(t, "hola!{\"error\":\"this is an error\"}", w.Body.String())
}
func TestSkippingPaths(t *testing.T) {
diff --git a/middleware_test.go b/middleware_test.go
index 3101d52..273d003 100644
--- a/middleware_test.go
+++ b/middleware_test.go
@@ -245,6 +245,6 @@ func TestMiddlewareWrite(t *testing.T) {
w := performRequest(router, "GET", "/")
- assert.Equal(t, w.Code, 400)
- assert.Equal(t, strings.Replace(w.Body.String(), " ", "", -1), strings.Replace("hola\n{\"foo\":\"bar\"}\n{\"foo\":\"bar\"}\nevent:test\ndata:message\n\n", " ", "", -1))
+ assert.Equal(t, 400, w.Code)
+ assert.Equal(t, strings.Replace("hola\n{\"foo\":\"bar\"}{\"foo\":\"bar\"}event:test\ndata:message\n\n", " ", "", -1), strings.Replace(w.Body.String(), " ", "", -1))
}
diff --git a/render/render_test.go b/render/render_test.go
index 7a6ffb7..c814ff6 100644
--- a/render/render_test.go
+++ b/render/render_test.go
@@ -25,8 +25,8 @@ func TestRenderJSON(t *testing.T) {
err := (JSON{data}).Render(w)
assert.NoError(t, err)
- assert.Equal(t, w.Body.String(), "{\"foo\":\"bar\"}\n")
- assert.Equal(t, w.Header().Get("Content-Type"), "application/json; charset=utf-8")
+ assert.Equal(t, "{\"foo\":\"bar\"}", w.Body.String())
+ assert.Equal(t, "application/json; charset=utf-8", w.Header().Get("Content-Type"))
}
func TestRenderIndentedJSON(t *testing.T) {