This commit is contained in:
parent
5c4144444a
commit
17bee2852a
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
@ -40,6 +41,14 @@ func GetEndpoints(me *url.URL) (Endpoints, error) {
|
||||||
}
|
}
|
||||||
defer res.Body.Close()
|
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
|
var links linkheader.Links
|
||||||
|
|
||||||
if headers, e := res.Header["Link"]; e {
|
if headers, e := res.Header["Link"]; e {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user