Skip to content

Commit

Permalink
api: accept more response codes as valid
Browse files Browse the repository at this point in the history
Occasionally, we receive a 206 - Partial Content response code. However,
the body seems to include full (or at least parsable) data. To avoid any
seemingly random failures, we should accept all 2xx response codes as
valid responses.

Signed-off-by: Dimitrios Karagiannis <[email protected]>
  • Loading branch information
alkar committed Feb 12, 2020
1 parent dedbc15 commit 81f4e80
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion megaport/api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func (c *Client) do(req *http.Request, data interface{}) error {
if resp.StatusCode == http.StatusNotFound {
return ErrNotFound
}
if resp.StatusCode != http.StatusOK {
if resp.StatusCode < 200 || resp.StatusCode > 299 {
r := megaportResponse{}
if err := parseResponseBody(resp, &r); err != nil {
return err
Expand Down

0 comments on commit 81f4e80

Please sign in to comment.