mirror of https://github.com/jlelse/GoBlog
More fixes
This commit is contained in:
parent
64e7507f47
commit
088ae06b98
|
@ -350,12 +350,15 @@ func apSendSigned(blog *configBlog, activity interface{}, to string) error {
|
||||||
}
|
}
|
||||||
// Do request
|
// Do request
|
||||||
resp, err := http.DefaultClient.Do(r)
|
resp, err := http.DefaultClient.Do(r)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if !apRequestIsSuccess(resp.StatusCode) {
|
if !apRequestIsSuccess(resp.StatusCode) {
|
||||||
body, _ := ioutil.ReadAll(resp.Body)
|
body, _ := ioutil.ReadAll(resp.Body)
|
||||||
resp.Body.Close()
|
_ = resp.Body.Close()
|
||||||
return fmt.Errorf("signed request failed with status %d: %s", resp.StatusCode, string(body))
|
return fmt.Errorf("signed request failed with status %d: %s", resp.StatusCode, string(body))
|
||||||
}
|
}
|
||||||
return err
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func apNewID(blog *configBlog) (hash string, url string) {
|
func apNewID(blog *configBlog) (hash string, url string) {
|
||||||
|
|
|
@ -153,6 +153,7 @@ func indieAuthToken(w http.ResponseWriter, r *http.Request) {
|
||||||
data, err := verifyIndieAuthToken(r.Header.Get("Authorization"))
|
data, err := verifyIndieAuthToken(r.Header.Get("Authorization"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, "Invalid token or token not found", http.StatusUnauthorized)
|
http.Error(w, "Invalid token or token not found", http.StatusUnauthorized)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
res := &tokenResponse{
|
res := &tokenResponse{
|
||||||
Scope: strings.Join(data.Scopes, " "),
|
Scope: strings.Join(data.Scopes, " "),
|
||||||
|
@ -166,6 +167,7 @@ func indieAuthToken(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
return
|
||||||
} else if r.Method == http.MethodPost {
|
} else if r.Method == http.MethodPost {
|
||||||
r.ParseForm()
|
r.ParseForm()
|
||||||
// Token Revocation
|
// Token Revocation
|
||||||
|
@ -217,7 +219,10 @@ func indieAuthToken(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
http.Error(w, "", http.StatusBadRequest)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue