forked from Ivasoft/traefik
test: use MustNewRequest.
This commit is contained in:
committed by
Ludovic Fernandez
parent
2223587fc0
commit
a1a0420314
@@ -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.")
|
||||
|
||||
Reference in New Issue
Block a user