mirror of
https://github.com/go-kratos/kratos.git
synced 2026-05-22 10:15:24 +02:00
remove http client call option:selectFilter
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user