test: use MustNewRequest.
This commit is contained in:
parent
2223587fc0
commit
a1a0420314
7 changed files with 27 additions and 37 deletions
|
@ -5,8 +5,8 @@ import (
|
|||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/containous/traefik/testhelpers"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestStripPrefixRegex(t *testing.T) {
|
||||
|
@ -75,10 +75,9 @@ func TestStripPrefixRegex(t *testing.T) {
|
|||
})
|
||||
handler := NewStripPrefixRegex(handlerPath, testPrefixRegex)
|
||||
|
||||
req, err := http.NewRequest(http.MethodGet, "http://localhost"+test.path, nil)
|
||||
require.NoError(t, err, "%s: unexpected error.", test.path)
|
||||
|
||||
req := testhelpers.MustNewRequest(http.MethodGet, "http://localhost"+test.path, nil)
|
||||
resp := &httptest.ResponseRecorder{Code: http.StatusOK}
|
||||
|
||||
handler.ServeHTTP(resp, req)
|
||||
|
||||
assert.Equal(t, test.expectedStatusCode, resp.Code, "Unexpected status code.")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue