Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BodyEncoder ¶
type CertConfig ¶
type ClientConfig ¶
type ClientConfig struct { Timeout time.Duration Cert CertConfig ProxyURI string // 如果需要定制化tls, 设置该属性, 否则请使用Cert TlsConfig *tls.Config }
func (*ClientConfig) Default ¶
func (c *ClientConfig) Default()
type ClientInterface ¶
type ClientInterface interface { // SetConfig 覆盖原来的 Client 配置 SetConfig(config *ClientConfig) // GetConfig 返回当前客户端配置(副本) GetConfig() ClientConfig // DoRequest 默认请求接口 DoRequest(request *http.Request) (response *http.Response, err error) }
type MultipartDfInterface ¶
type MultipartDfInterface interface { Boundary(b string) MultipartDfInterface FileByPath(fieldName string, filePath string) MultipartDfInterface FileMem(fieldName string, fileName string, reader io.Reader) MultipartDfInterface Part(header textproto.MIMEHeader, reader io.Reader) MultipartDfInterface FieldValue(fieldName string, value string) MultipartDfInterface Field(fieldName string, reader io.Reader) MultipartDfInterface Close() error GetBoundary() string GetReader() io.Reader GetContentType() string Err() error }
type RequestDataflowInterface ¶
type RequestDataflowInterface interface { WithContext(ctx context.Context) RequestDataflowInterface Method(method string) RequestDataflowInterface Uri(uri string) RequestDataflowInterface Url(url string) RequestDataflowInterface Header(key string, values ...string) RequestDataflowInterface Query(key string, values ...string) RequestDataflowInterface Json(jsonAny interface{}) RequestDataflowInterface Body(body io.Reader) RequestDataflowInterface Any(data BodyEncoder) RequestDataflowInterface Xml(xmlAny interface{}) RequestDataflowInterface Multipart(multipartDf func(multipart MultipartDfInterface)) RequestDataflowInterface Err() error Request() (response *http.Response, err error) Result(result interface{}) (err error) RequestResHelper() (response ResponseHelper, err error) }
RequestDataflowInterface 是一个 Http 请求构建器, 建议将注释中的私有方法实现到内部
type RequestHandle ¶
type RequestHelperInterface ¶
type RequestHelperInterface interface { SetClient(client ClientInterface) GetClient() ClientInterface // WithMiddleware 设置中间件, 在初始化 RequestDataflowInterface 时调用 WithMiddleware(middlewares ...RequestMiddleware) // Df 返回链式构建实例, 该实例应该引用 RequestHelperInterface 的 ClientDriver 和 RequestHandle(middleware build以后的方法) Df() RequestDataflowInterface }
RequestHelperInterface 是一个 Client Wrap 类型接口, 面向上层
type RequestMiddleware ¶
type RequestMiddleware func(handle RequestHandle) RequestHandle
Click to show internal directories.
Click to hide internal directories.