This commit is contained in:
Janos Dobronszki
2021-04-21 11:31:39 +01:00
parent 0235f16741
commit c12e0e2c49

View File

@@ -3,7 +3,7 @@ package client
import (
"bytes"
"encoding/json"
"fmt"
"errors"
"io/ioutil"
"net/http"
"net/url"
@@ -123,7 +123,9 @@ func (client *Client) Call(service, endpoint string, request, response interface
if err != nil {
return err
}
fmt.Println(string(body))
if !(resp.StatusCode >= 200 && resp.StatusCode < 300) {
return errors.New(string(body))
}
return unmarshalResponse(body, response)
}