...

Source file src/github.com/aws/aws-sdk-go-v2/internal/protocoltest/mockHttpClient.go

Documentation: github.com/aws/aws-sdk-go-v2/internal/protocoltest

     1  package protocoltest
     2  
     3  import (
     4  	"io/ioutil"
     5  	"net/http"
     6  	"strings"
     7  )
     8  
     9  // HTTPClient is a mock http client used by protocol test cases to
    10  // respond success response back
    11  type HTTPClient struct{}
    12  
    13  // Do returns a mock success response to caller
    14  func (*HTTPClient) Do(request *http.Request) (*http.Response, error) {
    15  	return &http.Response{
    16  		StatusCode: 200,
    17  		Header:     request.Header,
    18  		Body:       ioutil.NopCloser(strings.NewReader("")),
    19  		Request:    request,
    20  	}, nil
    21  }
    22  
    23  // NewClient returns pointer of a new HTTPClient for protocol test client
    24  func NewClient() *HTTPClient {
    25  	return &HTTPClient{}
    26  }
    27  

View as plain text