github.com/prebid/prebid-server/v2@v2.18.0/currency/currency_mock.go (about)

     1  package currency
     2  
     3  import (
     4  	"io"
     5  	"net/http"
     6  	"strings"
     7  )
     8  
     9  // MockCurrencyRatesHttpClient is a simple http client mock returning a constant response body
    10  type MockCurrencyRatesHttpClient struct {
    11  	ResponseBody string
    12  }
    13  
    14  func (m *MockCurrencyRatesHttpClient) Do(req *http.Request) (*http.Response, error) {
    15  	return &http.Response{
    16  		Status:     "200 OK",
    17  		StatusCode: http.StatusOK,
    18  		Body:       io.NopCloser(strings.NewReader(m.ResponseBody)),
    19  	}, nil
    20  }