|
|
@ -18,6 +18,7 @@ package getter
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"bytes"
|
|
|
|
"crypto/tls"
|
|
|
|
"crypto/tls"
|
|
|
|
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
"io"
|
|
|
|
"net/http"
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
|
|
|
@ -67,7 +68,10 @@ func (g *HTTPGetter) get(href string) (*bytes.Buffer, error) {
|
|
|
|
|
|
|
|
|
|
|
|
resp, err := client.Do(req)
|
|
|
|
resp, err := client.Do(req)
|
|
|
|
if err != nil {
|
|
|
|
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 {
|
|
|
|
if resp.StatusCode != 200 {
|
|
|
|
return buf, errors.Errorf("failed to fetch %s : %s", href, resp.Status)
|
|
|
|
return buf, errors.Errorf("failed to fetch %s : %s", href, resp.Status)
|
|
|
|