mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
client: unexport httpAction
This commit is contained in:
parent
3f5e827e3c
commit
2aecbaf165
@ -66,12 +66,12 @@ type SyncableHTTPClient interface {
|
||||
}
|
||||
|
||||
type HTTPClient interface {
|
||||
Do(context.Context, HTTPAction) (*http.Response, []byte, error)
|
||||
Do(context.Context, httpAction) (*http.Response, []byte, error)
|
||||
}
|
||||
|
||||
type httpClientFactory func(CancelableTransport, url.URL) HTTPClient
|
||||
|
||||
type HTTPAction interface {
|
||||
type httpAction interface {
|
||||
HTTPRequest(url.URL) *http.Request
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ func (c *httpClusterClient) reset(tr CancelableTransport, eps []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *httpClusterClient) Do(ctx context.Context, act HTTPAction) (resp *http.Response, body []byte, err error) {
|
||||
func (c *httpClusterClient) Do(ctx context.Context, act httpAction) (resp *http.Response, body []byte, err error) {
|
||||
c.RLock()
|
||||
leps := len(c.endpoints)
|
||||
eps := make([]url.URL, leps)
|
||||
@ -186,7 +186,7 @@ type simpleHTTPClient struct {
|
||||
endpoint url.URL
|
||||
}
|
||||
|
||||
func (c *simpleHTTPClient) Do(ctx context.Context, act HTTPAction) (*http.Response, []byte, error) {
|
||||
func (c *simpleHTTPClient) Do(ctx context.Context, act httpAction) (*http.Response, []byte, error) {
|
||||
req := act.HTTPRequest(c.endpoint)
|
||||
|
||||
rtchan := make(chan roundTripResponse, 1)
|
||||
@ -230,7 +230,7 @@ type redirectFollowingHTTPClient struct {
|
||||
max int
|
||||
}
|
||||
|
||||
func (r *redirectFollowingHTTPClient) Do(ctx context.Context, act HTTPAction) (*http.Response, []byte, error) {
|
||||
func (r *redirectFollowingHTTPClient) Do(ctx context.Context, act httpAction) (*http.Response, []byte, error) {
|
||||
for i := 0; i <= r.max; i++ {
|
||||
resp, body, err := r.client.Do(ctx, act)
|
||||
if err != nil {
|
||||
@ -257,7 +257,7 @@ func (r *redirectFollowingHTTPClient) Do(ctx context.Context, act HTTPAction) (*
|
||||
}
|
||||
|
||||
type redirectedHTTPAction struct {
|
||||
action HTTPAction
|
||||
action httpAction
|
||||
location url.URL
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ type staticHTTPClient struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func (s *staticHTTPClient) Do(context.Context, HTTPAction) (*http.Response, []byte, error) {
|
||||
func (s *staticHTTPClient) Do(context.Context, httpAction) (*http.Response, []byte, error) {
|
||||
return &s.resp, nil, s.err
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ type multiStaticHTTPClient struct {
|
||||
cur int
|
||||
}
|
||||
|
||||
func (s *multiStaticHTTPClient) Do(context.Context, HTTPAction) (*http.Response, []byte, error) {
|
||||
func (s *multiStaticHTTPClient) Do(context.Context, httpAction) (*http.Response, []byte, error) {
|
||||
r := s.responses[s.cur]
|
||||
s.cur++
|
||||
return &r.resp, nil, r.err
|
||||
|
Loading…
x
Reference in New Issue
Block a user