Commit f4e6ac07 authored by Lukas Burgey's avatar Lukas Burgey
Browse files

Add some logging

parent e83f996d
......@@ -226,7 +226,8 @@ func (sink *Sink) depHandler() {
}
func (sink *Sink) sendReply(reply deps.Reply) (err error) {
taskResponse, err := json.MarshalIndent(reply, "", " ")
var taskResponse []byte
taskResponse, err = json.MarshalIndent(reply, "", " ")
if err != nil {
return
}
......@@ -236,7 +237,8 @@ func (sink *Sink) sendReply(reply deps.Reply) (err error) {
}
url := fmt.Sprintf("https://%s/backend/clientapi/dep-state", sink.Config.Hostname)
req, err := http.NewRequest("PATCH", url, bytes.NewReader(taskResponse))
var req *http.Request
req, err = http.NewRequest("PATCH", url, bytes.NewReader(taskResponse))
if err != nil {
return
}
......@@ -244,15 +246,18 @@ func (sink *Sink) sendReply(reply deps.Reply) (err error) {
req.Header.Set("Content-Type", "application/json")
// execute request
resp, err := httpClient.Do(req)
var resp *http.Response
resp, err = httpClient.Do(req)
if err != nil {
return
}
defer resp.Body.Close()
var body []byte
body, readErr := ioutil.ReadAll(resp.Body)
if readErr != nil {
return readErr
log.Printf("sendReply: unable to read response body")
body = []byte{}
}
if resp.StatusCode != 200 {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment