-
Notifications
You must be signed in to change notification settings - Fork 0
/
http.go
29 lines (24 loc) · 596 Bytes
/
http.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package client
import (
"net/http"
"net/url"
)
type SimpleHTTPClient interface {
Get(url string) (resp *http.Response, err error)
PostForm(url string, data url.Values) (resp *http.Response, err error)
}
type MockHTTPClient struct {
url string
data url.Values
resp *http.Response
err error
}
func (mock *MockHTTPClient) PostForm(url string, data url.Values) (resp *http.Response, err error) {
mock.url = url
mock.data = data
return mock.resp, mock.err
}
func (mock *MockHTTPClient) Get(url string) (resp *http.Response, err error) {
mock.url = url
return mock.resp, mock.err
}