Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) Get(ctx context.Context, uri string, params interface{}, res interface{}, ...) error
- func (c *Client) NewRequest(ctx context.Context, method, uri string, params interface{}, res interface{}, ...) (err error)
- func (c *Client) Post(ctx context.Context, uri string, params interface{}, res interface{}, ...) error
- type Config
- type Option
- type Options
Constants ¶
View Source
const ( StatusOK = xhttp.StatusOK AuthToken = "AuthorizationToken" )
Variables ¶
View Source
var ( ErrNoResponse = errors.New("请求未能得到接口返回信息!") DefaultClient = NewClient(&Config{}) )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) NewRequest ¶
type Config ¶
type Config struct { CaCertPath string `json:"caCertPath" yaml:"caCertPath"` //启动https客户端的ca证书位置 Timeout time.Duration `json:"timeout" yaml:"timeout"` KeepAlive time.Duration `json:"keepAlive" yaml:"keepAlive"` MaxIdleConns int `json:"maxIdleConns" yaml:"maxIdleConns"` MaxIdleConnsPerHost int `json:"maxIdleConnsPerHost" yaml:"maxIdleConnsPerHost"` IdleConnTimeout time.Duration `json:"idleConnTimeout" yaml:"idleConnTimeout"` Debug bool `json:"debug" yaml:"debug"` //是否打印调试日志 DisableMetric bool `json:"disableMetric" yaml:"disableMetric"` //是否进行监控 DisableTrace bool `json:"disableTrace" yaml:"disableTrace"` //是否进行链路追踪 SlowThreshold time.Duration `json:"slowThreshold" yaml:"slowThreshold"` }
func DefaultConfig ¶
func DefaultConfig() Config
Click to show internal directories.
Click to hide internal directories.