Merge pull request #1 from stevenh/master
Only error on non-2XX HTTP response codes
This commit is contained in:
Коммит
78c138dd28
|
@ -68,7 +68,7 @@ func (codec *clientCodec) ReadResponseHeader(response *rpc.Response) (err error)
|
|||
seq := <-codec.ready
|
||||
httpResponse := codec.responses[seq]
|
||||
|
||||
if httpResponse.StatusCode != http.StatusOK {
|
||||
if httpResponse.StatusCode < 200 || httpResponse.StatusCode >= 300 {
|
||||
return fmt.Errorf("request error: bad status code - %d", httpResponse.StatusCode)
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ func (codec *clientCodec) ReadResponseHeader(response *rpc.Response) (err error)
|
|||
}
|
||||
|
||||
func (codec *clientCodec) ReadResponseBody(v interface{}) (err error) {
|
||||
if (v == nil) {
|
||||
if v == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче