mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-11 18:11:21 +08:00
Merge branch 'v5' into wings
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user