From c12e0e2c4955a16d75ed79333a8a13158bfb28f3 Mon Sep 17 00:00:00 2001 From: Janos Dobronszki Date: Wed, 21 Apr 2021 11:31:39 +0100 Subject: [PATCH] F --- client/client.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/client.go b/client/client.go index 654ed89..0be46c9 100644 --- a/client/client.go +++ b/client/client.go @@ -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) }