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