Skip to content

Commit

Permalink
新增使用自定义http.Client例子
Browse files Browse the repository at this point in the history
  • Loading branch information
guonaihong committed May 17, 2020
1 parent e1a6c51 commit b2587f7
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ gout 是go写的http 客户端,为提高工作效率而开发
* 支持retry-backoff,可以指定重试条件
* 支持发送裸http数据包
* 支持导出curl命令
* 传入自定义*http.Client
* 等等更多

## 演示
Expand Down Expand Up @@ -81,6 +82,7 @@ gout 是go写的http 客户端,为提高工作效率而开发
- [send raw http request](#send-raw-http-request)
- [export](#export)
- [generate curl command](#generate-curl-command)
- [Incoming custom * http.Client](#Incoming-custom-*http.Client)
- [Unique features](#Unique-features)
- [forward gin data](#forward-gin-data)

Expand Down Expand Up @@ -1536,6 +1538,33 @@ func main() {
fmt.Printf("%v\n", err)
}
```
# Incoming custom *http.Client
使用New接口即可使用自己的http.Client对象
```go
package main
import (
"fmt"
"net/http"
"github.com/guonaihong/gout"
)
func main() {
c := &http.Client{} //http.Client里面有fd连接池,如果对这块优化不是太了解,只使用一个实例就行
err := gout.New(c). // New接口可传入http.Client对象
GET("www.qq.com").
Debug(true).
Do()
if err != nil {
fmt.Printf("err = %s\n", err)
return
}
}
```
# Unique features
## forward gin data
Expand Down

0 comments on commit b2587f7

Please sign in to comment.