From 9aa870f108a1dab29abeba1f6289357a327e53d1 Mon Sep 17 00:00:00 2001 From: Gaozhen Ying Date: Tue, 10 Sep 2019 17:16:37 +0800 Subject: [PATCH] Adjust Render.Redirect test case (#2053) --- render/render_test.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/render/render_test.go b/render/render_test.go index b27134f..95a01b6 100644 --- a/render/render_test.go +++ b/render/render_test.go @@ -347,7 +347,17 @@ func TestRenderRedirect(t *testing.T) { } w = httptest.NewRecorder() - assert.Panics(t, func() { assert.NoError(t, data2.Render(w)) }) + assert.PanicsWithValue(t, "Cannot redirect with status code 200", func() { data2.Render(w) }) + + data3 := Redirect{ + Code: http.StatusCreated, + Request: req, + Location: "/new/location", + } + + w = httptest.NewRecorder() + err = data3.Render(w) + assert.NoError(t, err) // only improve coverage data2.WriteContentType(w)