Skip to content

Commit

Permalink
fix: check if request count exceeds the number of responses (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
chettriyuvraj authored Feb 7, 2024
1 parent 18655f8 commit 4292b61
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (m *MockRoundTripper) AssertGotRightCalls() {
func (m *MockRoundTripper) RoundTrip(r *http.Request) (*http.Response, error) {
m.t.Helper()

if len(m.responses) > m.requestCount+2 {
if m.requestCount >= len(m.responses) {
m.t.Fatalf("MockRoundTripper expected %d requests but got more", len(m.responses))
}
resp := m.responses[m.requestCount]
Expand Down

0 comments on commit 4292b61

Please sign in to comment.