@@ -10,41 +10,41 @@ import (
10
10
11
11
// Production
12
12
13
- type ProdClient struct {
13
+ type ProdExecutor struct {
14
14
* http.Client
15
15
}
16
16
17
- func (c * ProdClient ) SetCookieJar (jar http.CookieJar ) {
17
+ func (c * ProdExecutor ) SetCookieJar (jar http.CookieJar ) {
18
18
c .Jar = jar
19
19
}
20
20
21
- func (c * ProdClient ) SetCookies (url * url.URL , cookies []* http.Cookie ) {
21
+ func (c * ProdExecutor ) SetCookies (url * url.URL , cookies []* http.Cookie ) {
22
22
c .Jar .SetCookies (url , cookies )
23
23
}
24
24
25
- func (c * ProdClient ) SetCustomTimeout (timeout time.Duration ) {
25
+ func (c * ProdExecutor ) SetCustomTimeout (timeout time.Duration ) {
26
26
c .Timeout = timeout
27
27
}
28
28
29
- func (c * ProdClient ) Cookies (url * url.URL ) []* http.Cookie {
29
+ func (c * ProdExecutor ) Cookies (url * url.URL ) []* http.Cookie {
30
30
return c .Jar .Cookies (url )
31
31
}
32
32
33
- func (c * ProdClient ) SetRedirectPolicy (policy * func (req * http.Request , via []* http.Request ) error ) {
33
+ func (c * ProdExecutor ) SetRedirectPolicy (policy * func (req * http.Request , via []* http.Request ) error ) {
34
34
c .CheckRedirect = * policy
35
35
}
36
36
37
37
// Mocking
38
38
39
- type mockClient struct {
39
+ type MockExecutor struct {
40
40
lockedResponseCode int
41
41
}
42
42
43
- func (m * mockClient ) CloseIdleConnections () {
43
+ func (m * MockExecutor ) CloseIdleConnections () {
44
44
panic ("invalid function call" )
45
45
}
46
46
47
- func (m * mockClient ) Do (req * http.Request ) (* http.Response , error ) {
47
+ func (m * MockExecutor ) Do (req * http.Request ) (* http.Response , error ) {
48
48
statusString := http .StatusText (m .lockedResponseCode )
49
49
50
50
if statusString == "" {
@@ -56,30 +56,30 @@ func (m *mockClient) Do(req *http.Request) (*http.Response, error) {
56
56
return response , nil
57
57
}
58
58
59
- func (m * mockClient ) Get (_ string ) (* http.Response , error ) {
59
+ func (m * MockExecutor ) Get (_ string ) (* http.Response , error ) {
60
60
return m .Do (nil )
61
61
}
62
62
63
- func (m * mockClient ) Head (_ string ) (* http.Response , error ) {
63
+ func (m * MockExecutor ) Head (_ string ) (* http.Response , error ) {
64
64
return m .Do (nil )
65
65
}
66
66
67
- func (m * mockClient ) Post (_ string , _ string , _ io.Reader ) (* http.Response , error ) {
67
+ func (m * MockExecutor ) Post (_ string , _ string , _ io.Reader ) (* http.Response , error ) {
68
68
return m .Do (nil )
69
69
}
70
70
71
- func (m * mockClient ) PostForm (_ string , _ url.Values ) (* http.Response , error ) {
71
+ func (m * MockExecutor ) PostForm (_ string , _ url.Values ) (* http.Response , error ) {
72
72
return m .Do (nil )
73
73
}
74
74
75
- func (m * mockClient ) SetCookieJar (jar http.CookieJar ) {}
75
+ func (m * MockExecutor ) SetCookieJar (jar http.CookieJar ) {}
76
76
77
- func (m * mockClient ) SetCookies (url * url.URL , cookies []* http.Cookie ) {}
77
+ func (m * MockExecutor ) SetCookies (url * url.URL , cookies []* http.Cookie ) {}
78
78
79
- func (m * mockClient ) SetCustomTimeout (time.Duration ) {}
79
+ func (m * MockExecutor ) SetCustomTimeout (time.Duration ) {}
80
80
81
- func (m * mockClient ) Cookies (* url.URL ) []* http.Cookie {
81
+ func (m * MockExecutor ) Cookies (* url.URL ) []* http.Cookie {
82
82
return nil
83
83
}
84
84
85
- func (m * mockClient ) SetRedirectPolicy (* func (req * http.Request , via []* http.Request ) error ) {}
85
+ func (m * MockExecutor ) SetRedirectPolicy (* func (req * http.Request , via []* http.Request ) error ) {}
0 commit comments