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
|
package protocoltest
import (
"io/ioutil"
"net/http"
"strings"
)
// HTTPClient is a mock http client used by protocol test cases to
// respond success response back
type HTTPClient struct{}
// Do returns a mock success response to caller
func (*HTTPClient) Do(request *http.Request) (*http.Response, error) {
return &http.Response{
StatusCode: 200,
Header: request.Header,
Body: ioutil.NopCloser(strings.NewReader("")),
Request: request,
}, nil
}
// NewClient returns pointer of a new HTTPClient for protocol test client
func NewClient() *HTTPClient {
return &HTTPClient{}
}
|