Documentation
¶
Overview ¶
Package httpapi 提供重构 DNS provider 共用的最小 HTTP 客户端。
只依赖标准库:统一超时、错误体截断、JSON/XML 解码与请求构造。 签名逻辑放在各自的 sdk/<vendor> 包中,通过 NewRequest/Send 组合。
Index ¶
- func CloneHeader(in http.Header) http.Header
- func EncodeJSON(v any) ([]byte, error)
- func EncodeXML(v any) ([]byte, error)
- func IsConflict(err error) bool
- func IsNotFound(err error) bool
- func IsRateLimited(err error) bool
- func JSON(body []byte, out any) error
- func XML(body []byte, out any) error
- type Client
- func (c *Client) Do(ctx context.Context, method, path string, query url.Values, header http.Header, ...) (*Response, error)
- func (c *Client) NewRequest(ctx context.Context, method, path string, query url.Values, header http.Header, ...) (*http.Request, error)
- func (c *Client) Send(req *http.Request) (*Response, error)
- type Error
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloneHeader ¶
CloneHeader 复制 header,避免签名过程修改调用方数据。
Types ¶
type Client ¶
Client 是最小 HTTP 客户端。
func (*Client) Do ¶
func (c *Client) Do(ctx context.Context, method, path string, query url.Values, header http.Header, body []byte) (*Response, error)
Do 是 NewRequest + Send 的便捷封装。