Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErroringRoundTripFunc ¶
type ErroringRoundTripFunc func() error
ErroringRoundTripFunc Needed to Mock Http client that returns an error even before the request is made
Usage
&http.Client{ Transport: helpers.ErroringRoundTripFunc(func() error { return fmt.Errorf("some error") }), }
type RoundTripFunc ¶
RoundTripFunc Needed to Mock Http client requests and responses
Usage
&http.Client{ Transport: helpers.RoundTripFunc(func(req *http.Request) *http.Response { bodyBytes, _ := ioutil.ReadAll(req.Body) suite.EqualValues(expectedBody, string(bodyBytes)) suite.Equal(req.URL.String(), expectedUrl) return &http.Response{ StatusCode: returnedStatusCode, } }), }
Click to show internal directories.
Click to hide internal directories.