Last active
August 1, 2017 23:57
-
-
Save patrickmcguire/c02009e0d4cd0cd30e0d46dedbf34509 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
err = backoff.Retry(func() error { | |
bodyReader := bytes.NewReader(payload) | |
resp, err := http.Post(c.BaseEndpoint+"/v1/set", "application/json", bodyReader) | |
if err != nil { | |
return err | |
} | |
defer resp.Body.Close() | |
response := map[string]interface{}{} | |
dec := json.NewDecoder(resp.Body) | |
dec.Decode(&response) | |
if resp.StatusCode != http.StatusOK { | |
return fmt.Errorf( | |
"HTTP Post Request Failed, Status Code %d. \nResponse: %v \nRequest payload: %v", | |
resp.StatusCode, | |
response, | |
string(payload) | |
) | |
} | |
return nil | |
}, b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment