Skip to content

Commit b08ce66

Browse files
TzKT no content
1 parent b50e3b1 commit b08ce66

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tzkt/api/api.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,14 @@ func (tzkt *API) json(endpoint string, args map[string]string, output interface{
5656
}
5757
defer resp.Body.Close()
5858

59-
if resp.StatusCode == http.StatusOK {
59+
switch resp.StatusCode {
60+
case http.StatusOK:
6061
return json.NewDecoder(resp.Body).Decode(output)
62+
case http.StatusNoContent:
63+
return nil
64+
default:
65+
return errors.New(fmt.Sprintf("%s: %s %v", resp.Status, endpoint, args))
6166
}
62-
63-
return errors.New(fmt.Sprintf("%s: %s %v", resp.Status, endpoint, args))
6467
}
6568

6669
func (tzkt *API) count(endpoint string) (uint64, error) {

0 commit comments

Comments
 (0)