Skip to content

[Backport 7.17] Check error in BaseClient.Perform #922 #926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions elasticsearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,12 @@ func (c *Client) Perform(req *http.Request) (*http.Response, error) {

// Retrieve the original request.
res, err := c.Transport.Perform(req)
if err != nil {
return nil, err
}

// ResponseCheck path continues, we run the header check on the first answer from ES.
if err == nil && (res.StatusCode >= 200 && res.StatusCode < 300){
if res.StatusCode >= 200 && res.StatusCode < 300 {
checkHeader := func(context.Context) error {
return genuineCheckHeader(res.Header)
}
Expand All @@ -313,7 +316,7 @@ func (c *Client) Perform(req *http.Request) (*http.Response, error) {
return nil, err
}
}
return res, err
return res, nil
}

// doProductCheck calls f if there as not been a prior successful call to doProductCheck,
Expand Down