@@ -406,6 +406,7 @@ func TestResponseCheckOnly(t *testing.T) {
406406 {
407407 name : "Valid answer without header" ,
408408 response : & http.Response {
409+ StatusCode : http .StatusOK ,
409410 Body : ioutil .NopCloser (strings .NewReader ("{}" )),
410411 },
411412 wantErr : true ,
@@ -421,6 +422,7 @@ func TestResponseCheckOnly(t *testing.T) {
421422 {
422423 name : "Valid answer without header and response check" ,
423424 response : & http.Response {
425+ StatusCode : http .StatusOK ,
424426 Body : ioutil .NopCloser (strings .NewReader ("{}" )),
425427 },
426428 wantErr : true ,
@@ -438,7 +440,7 @@ func TestResponseCheckOnly(t *testing.T) {
438440 Body : ioutil .NopCloser (strings .NewReader ("" )),
439441 },
440442 requestErr : nil ,
441- wantErr : true ,
443+ wantErr : false ,
442444 },
443445 {
444446 name : "Valid request, 404 response" ,
@@ -447,7 +449,7 @@ func TestResponseCheckOnly(t *testing.T) {
447449 Body : ioutil .NopCloser (strings .NewReader ("" )),
448450 },
449451 requestErr : nil ,
450- wantErr : true ,
452+ wantErr : false ,
451453 },
452454 {
453455 name : "Valid request, 403 response" ,
@@ -494,14 +496,15 @@ func TestProductCheckError(t *testing.T) {
494496 w .WriteHeader (http .StatusBadGateway )
495497 return
496498 }
499+
497500 w .Header ().Set ("X-Elastic-Product" , "Elasticsearch" )
498501 w .Write ([]byte ("{}" ))
499502 }))
500503 defer server .Close ()
501504
502505 c , _ := NewClient (Config {Addresses : []string {server .URL }, DisableRetry : true })
503- if _ , err := c .Cat .Indices (); err = = nil {
504- t .Fatal ( "expected error" )
506+ if _ , err := c .Cat .Indices (); err ! = nil {
507+ t .Fatalf ( "unexpected error: %s" , err )
505508 }
506509 if c .productCheckSuccess {
507510 t .Fatalf ("product check should be invalid, got %v" , c .productCheckSuccess )
0 commit comments