Skip to content

Commit

Permalink
Check error in BaseClient.Perform #922 (#926)
Browse files Browse the repository at this point in the history
  • Loading branch information
Anaethelion authored Nov 27, 2024
1 parent 7c663a6 commit e2419cf
Showing 1 changed file with 5 additions and 2 deletions.
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

0 comments on commit e2419cf

Please sign in to comment.