mirror of
https://github.com/writefreely/writefreely
synced 2024-11-28 11:30:18 +00:00
Properly handle failed AP requests
This commit is contained in:
parent
0eac9251c0
commit
58d163d2e0
1 changed files with 6 additions and 4 deletions
|
@ -460,14 +460,13 @@ func makeActivityPost(p *activitystreams.Person, url string, m interface{}) erro
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := http.DefaultClient.Do(r)
|
resp, err := http.DefaultClient.Do(r)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if resp != nil && resp.Body != nil {
|
if resp != nil && resp.Body != nil {
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
if resp == nil {
|
|
||||||
log.Error("No response.")
|
|
||||||
return fmt.Errorf("No resonse.")
|
|
||||||
}
|
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
body, err := ioutil.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -497,6 +496,9 @@ func resolveIRI(url string) ([]byte, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := http.DefaultClient.Do(r)
|
resp, err := http.DefaultClient.Do(r)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
if resp != nil && resp.Body != nil {
|
if resp != nil && resp.Body != nil {
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue