module
Version:
v0.0.0-...-fa91634
Opens a new window with list of versions in this module.
Published: Jul 1, 2022
License: Apache-2.0
Opens a new window with license information.
README
¶
doak-curl
go 版本的 curl 对外请求库
项目介绍
使用方法
- 下载
go get -u github.com/deatil/doak-curl
- 使用
package main
import (
"fmt"
"github.com/deatil/doak-curl/curl"
)
func main() {
client := curl.New(
curl.WithBaseURI("http://yourdomain.com/api"),
curl.WithTimeout(35),
curl.WithResCharset("utf-8"),
)
resp, err := client.Get(
"/get-data",
curl.WithParams(map[string]any{
"p": "123",
}),
)
if err != nil {
fmt.Println(err.Error())
return
}
data, err2 := resp.GetContents()
if err2 != nil {
fmt.Println(err2.Error())
return
}
fmt.Println(data)
}
开源协议
doak-curl
遵循 Apache2
开源协议发布,在保留本软件版权的情况下提供个人及商业免费使用。
版权
Directories
¶
Click to show internal directories.
Click to hide internal directories.