File: mockHttpClient.go

package info (click to toggle)
golang-github-aws-aws-sdk-go-v2 1.24.1-2~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 554,032 kB
  • sloc: java: 15,941; makefile: 419; sh: 175
file content (26 lines) | stat: -rw-r--r-- 606 bytes parent folder | download | duplicates (4)
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{}
}