Documentation ¶
Index ¶
- Variables
- func DownloadHttpResult(url, filePath string, timeout time.Duration) error
- func Get(url string, data []byte, timeout time.Duration, headers ...HeaderOption) ([]byte, error)
- func GetAny(url string, data []byte, timeout time.Duration, v any, headers ...HeaderOption) error
- func GetHttpResult(url string, timeout time.Duration) ([]byte, error)
- func GetResponse(url string, data []byte, timeout time.Duration, headers ...HeaderOption) (*http.Response, error)
- func GetString(url string, data []byte, timeout time.Duration, headers ...HeaderOption) (string, error)
- func PostForm(url string, data map[string]string, urlEncode bool, timeout time.Duration, ...) ([]byte, error)
- func PostFormAny(url string, data map[string]string, timeout time.Duration, v any, ...) error
- func PostFormString(url string, data map[string]string, timeout time.Duration, ...) (string, error)
- func PostJson(url string, data []byte, timeout time.Duration, headers ...HeaderOption) ([]byte, error)
- func PostJsonAny(url string, data []byte, timeout time.Duration, v any, headers ...HeaderOption) error
- func PostJsonString(url string, data []byte, timeout time.Duration, headers ...HeaderOption) (string, error)
- type Curl
- func (c *Curl) Close() error
- func (c *Curl) Debug()
- func (c *Curl) Response(t time.Duration) (*http.Response, error)
- func (c *Curl) Result(t time.Duration) ([]byte, error)
- func (c *Curl) ResultAny(t time.Duration, v any) error
- func (c *Curl) ResultString(t time.Duration) (string, error)
- func (c *Curl) SetHeader(headers ...HeaderOption) *Curl
- type HeaderOption
Constants ¶
This section is empty.
Variables ¶
View Source
var ( GET = method{/* contains filtered or unexported fields */} POST = method{/* contains filtered or unexported fields */} PUT = method{/* contains filtered or unexported fields */} DELETE = method{/* contains filtered or unexported fields */} HEAD = method{/* contains filtered or unexported fields */} PATCH = method{/* contains filtered or unexported fields */} CONNECT = method{/* contains filtered or unexported fields */} OPTIONS = method{/* contains filtered or unexported fields */} TRACE = method{/* contains filtered or unexported fields */} )
View Source
var ( JsonHeader = HeaderOption{Key: "Content-Type", Value: "application/json;charset=UTF-8"} FormHeader = HeaderOption{Key: "Content-Type", Value: "application/x-www-form-urlencoded"} FormDataHeader = HeaderOption{Key: "Content-Type", Value: "multipart/form-data"} HtmlHeader = HeaderOption{Key: "Content-Type", Value: "text/html;charset=utf-8"} JsHeader = HeaderOption{Key: "Content-Type", Value: "text/javascript;charset=utf-8"} JsxHeader = HeaderOption{Key: "Content-Type", Value: "application/x-javascript"} CssHeader = HeaderOption{Key: "Content-Type", Value: "text/css;charset=utf-8"} JpegHeader = HeaderOption{Key: "Content-Type", Value: "image/jpeg"} GifHeader = HeaderOption{Key: "Content-Type", Value: "image/gif"} PngHeader = HeaderOption{Key: "Content-Type", Value: "image/png"} SvgHeader = HeaderOption{Key: "Content-Type", Value: "image/svg+xml"} )
Functions ¶
func DownloadHttpResult ¶
DownloadHttpResult 存储网络资源
func GetHttpResult ¶
GetHttpResult 获取网络资源
func GetResponse ¶ added in v0.0.4
func PostFormAny ¶
func PostFormString ¶
func PostJsonAny ¶
func PostJsonString ¶
Types ¶
type Curl ¶
type Curl struct { Err error // contains filtered or unexported fields }
func (*Curl) SetHeader ¶
func (c *Curl) SetHeader(headers ...HeaderOption) *Curl
type HeaderOption ¶
Click to show internal directories.
Click to hide internal directories.