This commit is contained in:
parent
5c4144444a
commit
17bee2852a
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
|
@ -40,6 +41,14 @@ func GetEndpoints(me *url.URL) (Endpoints, error) {
|
|||
}
|
||||
defer res.Body.Close()
|
||||
|
||||
if res.StatusCode != 200 {
|
||||
body, err := ioutil.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
return endpoints, fmt.Errorf("error from endpoint while reading body %d", res.StatusCode)
|
||||
}
|
||||
return endpoints, fmt.Errorf("error from endpoint %d: %s", res.StatusCode, body)
|
||||
}
|
||||
|
||||
var links linkheader.Links
|
||||
|
||||
if headers, e := res.Header["Link"]; e {
|
||||
|
|
Loading…
Reference in New Issue
Block a user