mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-17 09:37:02 +00:00
chore: more small lint/perf fixes (#493)
Signed-off-by: James Hillyerd <james@hillyerd.com>
This commit is contained in:
@@ -13,7 +13,7 @@ type options struct {
|
||||
|
||||
// Option can apply itself to the private options type.
|
||||
type Option interface {
|
||||
apply(*options)
|
||||
apply(opts *options)
|
||||
}
|
||||
|
||||
func getDefaultOptions() *options {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
// httpClient allows http.Client to be mocked for tests
|
||||
type httpClient interface {
|
||||
Do(*http.Request) (*http.Response, error)
|
||||
Do(req *http.Request) (*http.Response, error)
|
||||
}
|
||||
|
||||
// Generic REST restClient
|
||||
|
||||
@@ -7,6 +7,8 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
const baseURLStr = "http://test.local:8080"
|
||||
@@ -78,10 +80,11 @@ func TestDoTable(t *testing.T) {
|
||||
t.Run(testname, func(t *testing.T) {
|
||||
mth := &mockHTTPClient{}
|
||||
c := &restClient{mth, test.base}
|
||||
_, err := c.do(test.method, test.uri, test.wantBody)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
resp, err := c.do(test.method, test.uri, test.wantBody)
|
||||
require.NoError(t, err)
|
||||
err = resp.Body.Close()
|
||||
require.NoError(t, err)
|
||||
|
||||
if mth.req.Method != test.wantMethod {
|
||||
t.Errorf("req.Method == %q, want %q", mth.req.Method, test.wantMethod)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user