Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deatil/doak-curl
go 版本的 curl 对外请求库
https://github.com/deatil/doak-curl
curl doak-curl go go-curl http
Last synced: about 2 months ago
JSON representation
go 版本的 curl 对外请求库
- Host: GitHub
- URL: https://github.com/deatil/doak-curl
- Owner: deatil
- License: apache-2.0
- Created: 2022-07-01T04:23:15.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-07-01T04:27:51.000Z (over 2 years ago)
- Last Synced: 2024-10-12T11:27:51.982Z (3 months ago)
- Topics: curl, doak-curl, go, go-curl, http
- Language: Go
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## doak-curl
go 版本的 curl 对外请求库
### 项目介绍
* 使用 go 开发的对外请求库
### 使用方法
1. 下载
```go
go get -u github.com/deatil/doak-curl
```2. 使用
```go
package mainimport (
"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` 开源协议发布,在保留本软件版权的情况下提供个人及商业免费使用。
### 版权
* 该系统所属版权归 deatil(https://github.com/deatil) 所有。