|
@@ -87,10 +87,16 @@ func newClientWithTransport(tr *transport.HTTPTransport, timeout time.Duration)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// requestFactory defines an interface that transports can implement to
|
|
|
|
+// create new requests. It's used in testing.
|
|
|
|
+type requestFactory interface {
|
|
|
|
+ NewRequest(path string, data io.Reader) (*http.Request, error)
|
|
|
|
+}
|
|
|
|
+
|
|
// Client represents a plugin client.
|
|
// Client represents a plugin client.
|
|
type Client struct {
|
|
type Client struct {
|
|
http *http.Client // http client to use
|
|
http *http.Client // http client to use
|
|
- requestFactory transport.RequestFactory
|
|
|
|
|
|
+ requestFactory requestFactory
|
|
}
|
|
}
|
|
|
|
|
|
// RequestOpts is the set of options that can be passed into a request
|
|
// RequestOpts is the set of options that can be passed into a request
|