mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-12 12:27:09 +02:00
19 lines
337 B
Go
19 lines
337 B
Go
|
|
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
|
||
|
|
}
|