@@ -21,7 +21,6 @@ import (
2121	"encoding/base64" 
2222	"errors" 
2323	"fmt" 
24- 	"go.opentelemetry.io/otel/trace" 
2524	"net/http" 
2625	"net/url" 
2726	"os" 
@@ -32,13 +31,12 @@ import (
3231	"sync" 
3332	"time" 
3433
35- 	"github.com/elastic/go-elasticsearch/v8/typedapi" 
36- 
37- 	"github.com/elastic/go-elasticsearch/v8/esapi" 
38- 	"github.com/elastic/go-elasticsearch/v8/internal/version" 
39- 
4034	"github.com/elastic/elastic-transport-go/v8/elastictransport" 
4135	tpversion "github.com/elastic/elastic-transport-go/v8/elastictransport/version" 
36+ 	"github.com/elastic/go-elasticsearch/v8/esapi" 
37+ 	"github.com/elastic/go-elasticsearch/v8/internal/version" 
38+ 	"github.com/elastic/go-elasticsearch/v8/typedapi" 
39+ 	"go.opentelemetry.io/otel/trace" 
4240)
4341
4442const  (
@@ -341,17 +339,20 @@ func (c *BaseClient) Perform(req *http.Request) (*http.Response, error) {
341339
342340	// Retrieve the original request. 
343341	res , err  :=  c .Transport .Perform (req )
342+ 	if  err  !=  nil  {
343+ 		return  nil , err 
344+ 	}
344345
345346	// ResponseCheck, we run the header check on the first answer from ES. 
346- 	if  err   ==   nil   &&  ( res .StatusCode  >=  200  &&  res .StatusCode  <  300 )  {
347+ 	if  res .StatusCode  >=  200  &&  res .StatusCode  <  300  {
347348		checkHeader  :=  func () error  { return  genuineCheckHeader (res .Header ) }
348349		if  err  :=  c .doProductCheck (checkHeader ); err  !=  nil  {
349350			res .Body .Close ()
350351			return  nil , err 
351352		}
352353	}
353354
354- 	return  res , err 
355+ 	return  res , nil 
355356}
356357
357358// InstrumentationEnabled propagates back to the client the Instrumentation provided by the transport. 
0 commit comments