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

View File

@@ -38,10 +38,15 @@ type DriverRequests struct {
Error string `json:"error,omitempty"`
}
const (
rawSessionID = "<NoSession>"
)
func NewDriverSession() *DriverSession {
timeout := 30 * time.Second
session := &DriverSession{
ctx: context.Background(),
ID: rawSessionID,
timeout: timeout,
client: &http.Client{
Timeout: timeout,
@@ -95,6 +100,11 @@ func (s *DriverSession) concatURL(urlStr string) (string, error) {
return s.baseUrl, nil
}
// replace with session ID
if s.ID != rawSessionID {
urlStr = strings.Replace(urlStr, rawSessionID, s.ID, 1)
}
// 处理完整 URL
if strings.HasPrefix(urlStr, "http://") || strings.HasPrefix(urlStr, "https://") {
u, err := url.Parse(urlStr)