projects
/
kraftakt.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
63f08f7
)
Check status code when calling the subscription API.
author
Florian Forster
<ff@octo.it>
Wed, 10 Jan 2018 13:52:33 +0000
(14:52 +0100)
committer
Florian Forster
<ff@octo.it>
Wed, 10 Jan 2018 13:52:33 +0000
(14:52 +0100)
gfitsync.go
patch
|
blob
|
history
diff --git
a/gfitsync.go
b/gfitsync.go
index
7d90df6
..
614d513
100644
(file)
--- a/
gfitsync.go
+++ b/
gfitsync.go
@@
-152,6
+152,12
@@
func fitbitGrantHandler(ctx context.Context, w http.ResponseWriter, r *http.Requ
}
defer res.Body.Close()
+ if res.StatusCode >= 400 {
+ data, _ := ioutil.ReadAll(r.Body)
+ log.Errorf(ctx, "creating subscription failed: status %d %q", res.StatusCode, data)
+ return fmt.Errorf("creating subscription failed")
+ }
+
redirectURL := r.URL
redirectURL.Path = "/"
redirectURL.RawQuery = ""