-
-
Notifications
You must be signed in to change notification settings - Fork 296
Closed
Description
The following code does not work as expected when the first attempt does not succeed:
Eventually(func(ctx SpecContext) (*http.Response, error) {
req, err := http.NewRequestWithContext(ctx, http.MethodPost, "http://localhost:8080/test", strings.NewReader(query))
req.Header.Add("Content-Type", "application/json")
if err != nil {
return nil, err
}
return http.DefaultClient.Do(req)
}).
WithContext(ctx).
WithPolling(5 * time.Second).
WithTimeout(30 * time.Second).
Should(HaveHTTPBody(MatchJSON(expectedResult)))
This appears to be caused by the use of a cached variable that is never updated after being set:
https://github.com/onsi/gomega/blob/master/matchers/have_http_body_matcher.go#L76
Metadata
Metadata
Assignees
Labels
No labels