Merge branch 'v5' into wings

This commit is contained in:
余泓铮
2025-02-19 21:25:05 +08:00
2 changed files with 11 additions and 1 deletions
+1 -1
View File
@@ -1 +1 @@
v5.0.0+2502191738 v5.0.0+2502192122
+10
View File
@@ -38,10 +38,15 @@ type DriverRequests struct {
Error string `json:"error,omitempty"` Error string `json:"error,omitempty"`
} }
const (
rawSessionID = "<NoSession>"
)
func NewDriverSession() *DriverSession { func NewDriverSession() *DriverSession {
timeout := 30 * time.Second timeout := 30 * time.Second
session := &DriverSession{ session := &DriverSession{
ctx: context.Background(), ctx: context.Background(),
ID: rawSessionID,
timeout: timeout, timeout: timeout,
client: &http.Client{ client: &http.Client{
Timeout: timeout, Timeout: timeout,
@@ -95,6 +100,11 @@ func (s *DriverSession) concatURL(urlStr string) (string, error) {
return s.baseUrl, nil return s.baseUrl, nil
} }
// replace with session ID
if s.ID != rawSessionID {
urlStr = strings.Replace(urlStr, rawSessionID, s.ID, 1)
}
// 处理完整 URL // 处理完整 URL
if strings.HasPrefix(urlStr, "http://") || strings.HasPrefix(urlStr, "https://") { if strings.HasPrefix(urlStr, "http://") || strings.HasPrefix(urlStr, "https://") {
u, err := url.Parse(urlStr) u, err := url.Parse(urlStr)