import "go.chromium.org/luci/gce/appengine/testing/roundtripper"
Package roundtripper contains http.RoundTripper implementations suitable for testing.
type JSONRoundTripper struct { // Handler is called by RoundTrip with the unmarshalled JSON from an *http.Request. // Returns an HTTP status code and an interface{} to marshal as JSON in an *http.Response. Handler func(interface{}) (int, interface{}) // Type is the reflect.Type to unmarshal *http.Request.Body into. // Defaults to map[string]string{}. Type reflect.Type }
JSONRoundTripper implements http.RoundTripper to handle *http.Requests with a JSON body.
RoundTrip handles an *http.Request with a JSON body, returning an *http.Response with a JSON body. Panics on error. Implements http.RoundTripper.
type StringRoundTripper struct { // Handler is called by RoundTrip. // Returns an HTTP status code and a string to return in an *http.Response. Handler func(*http.Request) (int, string) }
StringRoundTripper implements http.RoundTripper to handle *http.Requests.
RoundTrip handles an *http.Request, returning an *http.Response with a string body. Panics on error. Implements http.RoundTripper.
Package roundtripper imports 7 packages (graph). Updated 2021-01-21. Refresh now. Tools for package owners.