Merge pull request #166 from brendandburns/sync

Part #1 of synchronous requests: Add channels and a mechanism for waiting
This commit is contained in:
Daniel Smith
2014-06-19 16:40:25 -07:00
6 changed files with 163 additions and 43 deletions

View File

@@ -95,7 +95,7 @@ func (client Client) rawRequest(method, path string, requestBody io.Reader, targ
if err != nil {
return body, err
}
if response.StatusCode != 200 {
if response.StatusCode < http.StatusOK || response.StatusCode > http.StatusPartialContent {
return nil, fmt.Errorf("request [%s %s] failed (%d) %s: %s", method, client.makeURL(path), response.StatusCode, response.Status, string(body))
}
if target != nil {