http.post和http.client.post的区别是什么

cjrey · · 1581 次点击
除此之外,功能上无任何差异吗?
#2
更多评论
http.post 调用默认生成好的结构 http.client.post 要自己生成 结构 client:= http.client{}; client.post()
#1
功能上差异是根据参数来的,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