change: update tests

This commit is contained in:
debugtalk
2022-10-27 22:01:29 +08:00
parent aa35fbf1ad
commit 055dde9d16
5 changed files with 85 additions and 16 deletions

View File

@@ -93,18 +93,10 @@ func (wd *Driver) httpRequest(method string, rawURL string, rawBody []byte) (raw
}
func convertToHTTPClient(conn net.Conn) *http.Client {
// set tcp keep alive
tcpConn := conn.(*net.TCPConn)
if err := tcpConn.SetKeepAlive(true); err != nil {
log.Error().Err(err).Msg("set tcp keep alive failed")
}
if err := tcpConn.SetKeepAlivePeriod(30 * time.Second); err != nil {
log.Error().Err(err).Msg("set tcp keep alive period failed")
}
return &http.Client{
Transport: &http.Transport{
DialContext: func(_ context.Context, _, _ string) (net.Conn, error) {
return tcpConn, nil
return conn, nil
},
},
Timeout: 0,