mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-04 23:16:57 +08:00
Merge branch 'v5' into wings
This commit is contained in:
@@ -1 +1 @@
|
|||||||
v5.0.0+2502191738
|
v5.0.0+2502192122
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user