You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to test retries with a specific http.Client.Timeout value. Response.Delay does not seem to work as expected. I set it to 60 and I set my http.Client.Timeout to 5. My retries are also set to retry after Client.Timeout. When I do this and run the following test it does not seem to timeout as expected. What I expect to happen is to retry twice after a maximum of 5 seconds per request. What happens instead is the test takes much longer to run. Any idea of a workaround or area of the gock code that might change to make this work? Happy to submit a PR for this with your guidance. Thanks.
gock.New(url).
Post("/endpoint").
Response.
Delay(60*time.Second)
gock.New(url).
Post("/endpoint").
Response.
Delay(60*time.Second)
gock.New(url).
Post("/endpoint").
MatchHeaders(expectedRequestHeaders).
Reply(http.StatusCreated)
client:=CreateHTTClientAdapter()
gock.InterceptClient(client.GetHTTPClient())
resp,err:=client.Post(generateBody(), test.CreateStandardHeaders())
assert.Nil(suite.T(), err, "err should be nil and should handle error through response")
assert.Equal(suite.T(), http.StatusCreated, resp.Status, "status should be 201/Created")
The text was updated successfully, but these errors were encountered:
Hello,
Great lib!
I'm trying to test retries with a specific
http.Client.Timeout
value.Response.Delay
does not seem to work as expected. I set it to 60 and I set myhttp.Client.Timeout
to 5. My retries are also set to retry after Client.Timeout. When I do this and run the following test it does not seem to timeout as expected. What I expect to happen is to retry twice after a maximum of 5 seconds per request. What happens instead is the test takes much longer to run. Any idea of a workaround or area of the gock code that might change to make this work? Happy to submit a PR for this with your guidance. Thanks.The text was updated successfully, but these errors were encountered: