diff --git a/monstercat/catalog_test.go b/monstercat/catalog_test.go index 9bf69b4..2933c1f 100644 --- a/monstercat/catalog_test.go +++ b/monstercat/catalog_test.go @@ -12,7 +12,7 @@ func TestBrowseCatalog_DefaultOptions(t *testing.T) { catalog, err := client.BrowseCatalog() assert.NoError(t, err) assert.NotEmpty(t, catalog.Data) - assert.Len(t, catalog.Data, 10) + assert.LessOrEqual(t, len(catalog.Data), 10) // the api sometimes skips entries without filling them up at the end assert.NotEqual(t, 0, catalog.Total) assert.True(t, catalog.HasNextPage()) } diff --git a/monstercat/login.go b/monstercat/login.go index 6a0fcf7..4342f1f 100644 --- a/monstercat/login.go +++ b/monstercat/login.go @@ -23,8 +23,11 @@ func (client *Client) Login(email string, password string) error { } defer response.Body.Close() - if response.StatusCode != http.StatusNoContent { - return ErrorInvalidCredentials + if response.StatusCode != http.StatusOK { + if response.StatusCode == http.StatusBadRequest { + return ErrorInvalidCredentials + } + return fmt.Errorf("unexpected status code: %d", response.StatusCode) } for _, cookie := range response.Cookies() { diff --git a/monstercat/monstercat.go b/monstercat/monstercat.go index de1336a..7197ec2 100644 --- a/monstercat/monstercat.go +++ b/monstercat/monstercat.go @@ -3,10 +3,10 @@ package monstercat import "fmt" const ( - endpointLogin = "https://www.monstercat.com/api/sign-in" - endpointCatalog = "https://www.monstercat.com/api/catalog/browse" + endpointLogin = "https://player.monstercat.app/api/sign-in" + endpointCatalog = "https://player.monstercat.app/api/catalog/browse" - endpointDownloadCatalogItem = "https://www.monstercat.com/api/release/%s/track-download/%s?format=%s" + endpointDownloadCatalogItem = "https://player.monstercat.app/api/release/%s/track-download/%s?format=%s" authenticationCookieName = "cid" )