Fix request, remove done step

This commit is contained in:
Peter Stuifzand 2018-01-30 21:13:21 +01:00
parent 349e5c7488
commit bde593b909
2 changed files with 5 additions and 8 deletions

View File

@ -20,10 +20,3 @@ pipeline:
- cd /home/hub/hub
- docker-compose pull
- docker-compose up -d
done:
image: ubuntu
commands:
- sh ./deployment.sh
environment:
- PUSHBULLET_API_TOKEN=${pushbullet_api_token}

View File

@ -45,6 +45,10 @@ func (handler *subscriptionHandler) handlePublish(w http.ResponseWriter, r *http
if subs, e := handler.Subscribers[topic]; e {
for _, sub := range subs {
req, err := http.NewRequest("POST", sub.Callback, res.Body)
if err != nil {
log.Printf("While creating request to %s: %s", sub.Callback, err)
continue
}
req.Header.Add("Content-Type", res.Header.Get("Content-Type"))
req.Header.Add("Link",
fmt.Sprintf(
@ -52,7 +56,7 @@ func (handler *subscriptionHandler) handlePublish(w http.ResponseWriter, r *http
"https://hub.stuifzandapp.com/",
topic,
))
res, err = http.Post(sub.Callback, res.Header.Get("Content-Type"), res.Body)
res, err = client.Do(req)
if err != nil {
log.Printf("While POSTing to %s: %s", sub.Callback, err)
continue