在Golang中想要复用之前的TCP连接,必须要把上一个连接的Body读取完毕才能复用
检查工具:httptrace.ClientTrace
测试代码:
package main
import (
"context"
"io"
"io/ioutil"
"log"
"net/http"
"net/http/httptrace"
)
func main() {
// client trace to log whether the request's underlying tcp connection was re-used
clientTrace := &httptrace.ClientTrace{
GotConn: func(info httptrace.GotConnInfo) {