refactor: moved http.Client to model.RequestContext
Signed-off-by: SoXX <soxx@fenpa.ws>
This commit is contained in:
parent
50e8cc24cb
commit
5e8c3509ea
@ -33,14 +33,14 @@ func TestGetPool(t *testing.T) {
|
|||||||
httpmock.RegisterResponder("GET", "https://e621.net/pools/36957.json", jsonResponser)
|
httpmock.RegisterResponder("GET", "https://e621.net/pools/36957.json", jsonResponser)
|
||||||
|
|
||||||
requestContext := model.RequestContext{
|
requestContext := model.RequestContext{
|
||||||
|
Client: http.Client{},
|
||||||
Host: "https://e621.net",
|
Host: "https://e621.net",
|
||||||
UserAgent: "Go-e621-SDK (@username)",
|
UserAgent: "Go-e621-SDK (@username)",
|
||||||
Username: "memo",
|
Username: "memo",
|
||||||
APIKey: "123456",
|
APIKey: "123456",
|
||||||
}
|
}
|
||||||
|
|
||||||
client := http.Client{}
|
pool, err := GetPool(requestContext, "36957")
|
||||||
pool, err := GetPool(client, requestContext, "36957")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
return
|
return
|
||||||
@ -121,14 +121,14 @@ func TestGetPools(t *testing.T) {
|
|||||||
httpmock.RegisterResponder("GET", "https://e621.net/pools.json", jsonResponser)
|
httpmock.RegisterResponder("GET", "https://e621.net/pools.json", jsonResponser)
|
||||||
|
|
||||||
requestContext := model.RequestContext{
|
requestContext := model.RequestContext{
|
||||||
|
Client: http.Client{},
|
||||||
Host: "https://e621.net",
|
Host: "https://e621.net",
|
||||||
UserAgent: "Go-e621-SDK (@username)",
|
UserAgent: "Go-e621-SDK (@username)",
|
||||||
Username: "memo",
|
Username: "memo",
|
||||||
APIKey: "123456",
|
APIKey: "123456",
|
||||||
}
|
}
|
||||||
|
|
||||||
client := http.Client{}
|
pools, err := GetPools(requestContext, map[string]string{})
|
||||||
pools, err := GetPools(client, requestContext, map[string]string{})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user