Skip to content

Commit 07130a4

Browse files
committed
private struct > publcic
1 parent 9028167 commit 07130a4

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

httpclient/http.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,41 @@ import (
1010

1111
// Production
1212

13-
type ProdClient struct {
13+
type ProdExecutor struct {
1414
*http.Client
1515
}
1616

17-
func (c *ProdClient) SetCookieJar(jar http.CookieJar) {
17+
func (c *ProdExecutor) SetCookieJar(jar http.CookieJar) {
1818
c.Jar = jar
1919
}
2020

21-
func (c *ProdClient) SetCookies(url *url.URL, cookies []*http.Cookie) {
21+
func (c *ProdExecutor) SetCookies(url *url.URL, cookies []*http.Cookie) {
2222
c.Jar.SetCookies(url, cookies)
2323
}
2424

25-
func (c *ProdClient) SetCustomTimeout(timeout time.Duration) {
25+
func (c *ProdExecutor) SetCustomTimeout(timeout time.Duration) {
2626
c.Timeout = timeout
2727
}
2828

29-
func (c *ProdClient) Cookies(url *url.URL) []*http.Cookie {
29+
func (c *ProdExecutor) Cookies(url *url.URL) []*http.Cookie {
3030
return c.Jar.Cookies(url)
3131
}
3232

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) {
3434
c.CheckRedirect = *policy
3535
}
3636

3737
// Mocking
3838

39-
type mockClient struct {
39+
type MockExecutor struct {
4040
lockedResponseCode int
4141
}
4242

43-
func (m *mockClient) CloseIdleConnections() {
43+
func (m *MockExecutor) CloseIdleConnections() {
4444
panic("invalid function call")
4545
}
4646

47-
func (m *mockClient) Do(req *http.Request) (*http.Response, error) {
47+
func (m *MockExecutor) Do(req *http.Request) (*http.Response, error) {
4848
statusString := http.StatusText(m.lockedResponseCode)
4949

5050
if statusString == "" {
@@ -56,30 +56,30 @@ func (m *mockClient) Do(req *http.Request) (*http.Response, error) {
5656
return response, nil
5757
}
5858

59-
func (m *mockClient) Get(_ string) (*http.Response, error) {
59+
func (m *MockExecutor) Get(_ string) (*http.Response, error) {
6060
return m.Do(nil)
6161
}
6262

63-
func (m *mockClient) Head(_ string) (*http.Response, error) {
63+
func (m *MockExecutor) Head(_ string) (*http.Response, error) {
6464
return m.Do(nil)
6565
}
6666

67-
func (m *mockClient) Post(_ string, _ string, _ io.Reader) (*http.Response, error) {
67+
func (m *MockExecutor) Post(_ string, _ string, _ io.Reader) (*http.Response, error) {
6868
return m.Do(nil)
6969
}
7070

71-
func (m *mockClient) PostForm(_ string, _ url.Values) (*http.Response, error) {
71+
func (m *MockExecutor) PostForm(_ string, _ url.Values) (*http.Response, error) {
7272
return m.Do(nil)
7373
}
7474

75-
func (m *mockClient) SetCookieJar(jar http.CookieJar) {}
75+
func (m *MockExecutor) SetCookieJar(jar http.CookieJar) {}
7676

77-
func (m *mockClient) SetCookies(url *url.URL, cookies []*http.Cookie) {}
77+
func (m *MockExecutor) SetCookies(url *url.URL, cookies []*http.Cookie) {}
7878

79-
func (m *mockClient) SetCustomTimeout(time.Duration) {}
79+
func (m *MockExecutor) SetCustomTimeout(time.Duration) {}
8080

81-
func (m *mockClient) Cookies(*url.URL) []*http.Cookie {
81+
func (m *MockExecutor) Cookies(*url.URL) []*http.Cookie {
8282
return nil
8383
}
8484

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

Comments
 (0)