Use resty response.IsSuccess() instead of checking for status code 200

This commit is contained in:
Philipp Wolfer 2024-03-24 16:36:53 +01:00
parent 3f1bebd8ed
commit 357932f9b0
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
5 changed files with 12 additions and 12 deletions

View file

@ -66,7 +66,7 @@ func (c Client) GetHistoryListenings(user string, page int, perPage int) (result
SetResult(&result).
Get(path)
if response.StatusCode() != 200 {
if !response.IsSuccess() {
err = errors.New(response.String())
return
}
@ -84,7 +84,7 @@ func (c Client) GetFavoriteTracks(page int, perPage int) (result FavoriteTracksR
SetResult(&result).
Get(path)
if response.StatusCode() != 200 {
if !response.IsSuccess() {
err = errors.New(response.String())
return
}