Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetJSONField ¶ added in v1.1.1
GetJSONField 支援巢狀 key,例如 "data.user.name" 如果 body 不是 JSON 或 key 不存在,回傳空字串
func NewMultipart ¶ added in v1.0.0
NewMultipart 建立 multipart body fields: form fields, files: key -> file path
Types ¶
type Client ¶ added in v1.2.1
type Client struct {
// contains filtered or unexported fields
}
func (*Client) NewRequest ¶ added in v1.2.1
type Request ¶ added in v1.0.0
type Request struct {
Method string
URL string
Headers map[string]string
Body io.Reader
// contains filtered or unexported fields
}
func NewRequest ¶ added in v1.0.0
建立 Request
method = GET / POST / PUT / PATCH / DELETE NewRequest 保留舊用法,使用預設 client(10 秒 timeout)
func NewRequest(method, url string) *Request {
method = strings.ToUpper(method) // ✅ 自動轉大寫
return &Request{
Method: method,
URL: url,
Headers: map[string]string{},
}
}
func (*Request) HeadersAdd ¶ added in v1.0.0
設定自訂 headers
Click to show internal directories.
Click to hide internal directories.