fix: web ui test

This commit is contained in:
徐聪
2025-05-06 02:02:28 +08:00
parent 37fd2e900d
commit 6cce5e3c5b
14 changed files with 347 additions and 60 deletions

View File

@@ -270,14 +270,18 @@ func (s *DriverSession) Request(method string, urlStr string, rawBody []byte) (
}
func (s *DriverSession) SetupPortForward(localPort int) error {
conn, err := net.Dial("tcp", fmt.Sprintf("127.0.0.1:%d", localPort))
if err != nil {
return fmt.Errorf("create tcp connection error %v", err)
}
// conn, err := net.Dial("tcp", fmt.Sprintf("127.0.0.1:%d", localPort))
// if err != nil {
// return fmt.Errorf("create tcp connection error %v", err)
// }
s.client.Transport = &http.Transport{
DialContext: func(_ context.Context, _, _ string) (net.Conn, error) {
return conn, nil
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
return net.Dial(network, fmt.Sprintf("127.0.0.1:%d", localPort))
},
MaxIdleConns: 10,
IdleConnTimeout: 30 * time.Second,
DisableKeepAlives: false,
TLSHandshakeTimeout: 10 * time.Second,
}
return nil
}