remove http client call option:selectFilter

pull/1488/head
longXboy 3 years ago
parent 53563ab498
commit 039ce62778
  1. 19
      transport/http/calloption.go
  2. 2
      transport/http/client.go

@ -2,8 +2,6 @@ package http
import (
"net/http"
"github.com/go-kratos/kratos/v2/selector"
)
// CallOption configures a Call before it starts or extracts information from
@ -22,7 +20,6 @@ type callInfo struct {
contentType string
operation string
pathTemplate string
filters []selector.Filter
}
// EmptyCallOption does not alter the Call configuration.
@ -93,22 +90,6 @@ func (o PathTemplateCallOption) before(c *callInfo) error {
return nil
}
// SelectFilter is http select filter
func SelectFilter(filters ...selector.Filter) CallOption {
return SelectFilterCallOption{filters: filters}
}
// SelectFilterCallOption is set call select filters
type SelectFilterCallOption struct {
EmptyCallOption
filters []selector.Filter
}
func (o SelectFilterCallOption) before(c *callInfo) error {
c.filters = o.filters
return nil
}
// Header returns a CallOptions that retrieves the http response header
// from server reply.
func Header(header *http.Header) CallOption {

@ -238,7 +238,7 @@ func (client *Client) invoke(ctx context.Context, req *http.Request, args interf
err error
node selector.Node
)
if node, done, err = client.opts.selector.Select(ctx, selector.WithFilter(c.filters...)); err != nil {
if node, done, err = client.opts.selector.Select(ctx); err != nil {
return nil, errors.ServiceUnavailable("NODE_NOT_FOUND", err.Error())
}
if client.insecure {

Loading…
Cancel
Save