Retry calls to Last.FM without MBIDs when if returns artist invalid (#1138)
* Call Last.FM's getInfo again without mbid when artist is not found * Call Last.FM's getSimilar again without mbid when artist is not found * Call Last.FM's getTopTracks again without mbid when artist is not found
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package tests
|
||||
|
||||
import "net/http"
|
||||
|
||||
type FakeHttpClient struct {
|
||||
Res http.Response
|
||||
Err error
|
||||
SavedRequest *http.Request
|
||||
RequestCount int
|
||||
}
|
||||
|
||||
func (c *FakeHttpClient) Do(req *http.Request) (*http.Response, error) {
|
||||
c.RequestCount++
|
||||
c.SavedRequest = req
|
||||
if c.Err != nil {
|
||||
return nil, c.Err
|
||||
}
|
||||
return &c.Res, nil
|
||||
}
|
||||
Reference in New Issue
Block a user