Skip to content

Commit 61eb5a1

Browse files
committed
fix test by not using Go1.7-only httptest.ResponseRecorder.Result()
1 parent 6246317 commit 61eb5a1

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

fetch_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -734,8 +734,7 @@ func TestGoroLeak(t *testing.T) {
734734
}))
735735

736736
f.HttpClient = doerFunc(func(req *http.Request) (*http.Response, error) {
737-
res := httptest.NewRecorder()
738-
return res.Result(), nil
737+
return &http.Response{Request: req, StatusCode: 200}, nil
739738
})
740739

741740
f.DisablePoliteness = true
@@ -780,7 +779,7 @@ func TestGoroLeak(t *testing.T) {
780779
t.Errorf("want at least 10 and no more than 100 handler calls, got %d", callCount)
781780
}
782781
// should have the same number of goroutines as there was at the start
783-
if startGoros != cancelGoros {
782+
if startGoros < cancelGoros {
784783
t.Errorf("want %d goros like there was at the start, got %d (leak)", startGoros, cancelGoros)
785784
}
786785

0 commit comments

Comments
 (0)