Skip to content

Commit

Permalink
fix: Use TestingT interface instead of *testing.T (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
ikawaha authored Nov 22, 2022
1 parent 21a6e2b commit fdfe1c0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"net/http/cookiejar"
"net/http/httptest"
"strings"
"testing"
"time"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -47,7 +46,7 @@ func NoRedirect() Option {
})
}

// Checker represents the HTTP checker without testing.T.
// Checker represents the HTTP checker without TestingT.
type Checker struct {
client *http.Client
request *http.Request
Expand Down Expand Up @@ -94,7 +93,7 @@ func (c *Checker) UnpersistCookie(cookie string) {
// TestRequest - If you want to provide you custom http.Request instance, you can do it using this method
// In this case internal http.Request instance won't be created, and passed instance will be used
// for making request
func (c *Checker) TestRequest(t *testing.T, request *http.Request) *Tester {
func (c *Checker) TestRequest(t TestingT, request *http.Request) *Tester {
require.NotNil(t, request, "request is nil")

c.request = request
Expand All @@ -105,7 +104,7 @@ func (c *Checker) TestRequest(t *testing.T, request *http.Request) *Tester {
}

// Test - Prepare for testing some part of code which lives on provided path and method.
func (c *Checker) Test(t *testing.T, method, path string) *Tester {
func (c *Checker) Test(t TestingT, method, path string) *Tester {
method = strings.ToUpper(method)
request, err := http.NewRequest(method, c.GetURL()+path, nil)

Expand Down

0 comments on commit fdfe1c0

Please sign in to comment.