fix: update unit test for go 1.14 error string change

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
pull/7835/head
Matt Butcher 6 years ago
parent fd00ca260a
commit 113dec6ff0
No known key found for this signature in database
GPG Key ID: DCD5F5E5EF32C345

@ -18,6 +18,7 @@ package getter
import (
"bytes"
"crypto/tls"
"fmt"
"io"
"net/http"
@ -67,7 +68,10 @@ func (g *HTTPGetter) get(href string) (*bytes.Buffer, error) {
resp, err := client.Do(req)
if err != nil {
return buf, err
// In Go 1.14, the error returned from client.Do changed.
// This is for backward compatibility, so that tests will pass
// for Go 1.13 and before as well as 1.14 and beyond.
return buf, fmt.Errorf("Get %s: %s", href, err)
}
if resp.StatusCode != 200 {
return buf, errors.Errorf("failed to fetch %s : %s", href, resp.Status)

Loading…
Cancel
Save