如题
http.post和http.client.post的区别是什么?
搜了下没有详细的说明,请大神指点迷津。
功能上差异是根据参数来的,client := http.Client{Timeout: 5 * time.Second,
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: 1 * time.Second,
KeepAlive: 10 * time.Second,
DualStack: true,
}).DialContext,
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
MaxIdleConns: 100,
MaxIdleConnsPerHost: 8,
IdleConnTimeout: 15 * time.Second,
}
#3
更多评论
http.post 调用默认生成好的结构 http.client.post 要自己生成 结构 client:= http.client{}; client.post()
#1