mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 15:37:35 +08:00
refactor: enhance JSON handling and improve request retry logic in DriverSession
This commit is contained in:
+11
-12
@@ -36,13 +36,19 @@ func NewWDADriver(device *IOSDevice) (*WDADriver, error) {
|
||||
Session: NewDriverSession(),
|
||||
}
|
||||
|
||||
if !device.Options.LazySetup {
|
||||
// setup driver
|
||||
if err := driver.Setup(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// setup driver
|
||||
if err := driver.Setup(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// check WDA status
|
||||
wdaStatus, err := driver.Status()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
log.Info().Interface("status", wdaStatus).
|
||||
Msg("check WDA status")
|
||||
|
||||
// register driver session reset handler
|
||||
driver.Session.RegisterResetHandler(driver.Setup)
|
||||
|
||||
@@ -146,13 +152,6 @@ func (wd *WDADriver) Setup() error {
|
||||
return err
|
||||
}
|
||||
|
||||
wdaStatus, err := wd.Status()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Info().Interface("status", wdaStatus).
|
||||
Msg("check WDA status")
|
||||
|
||||
// create new session
|
||||
if err := wd.InitSession(nil); err != nil {
|
||||
return errors.Wrap(code.DeviceHTTPDriverError, err.Error())
|
||||
|
||||
Reference in New Issue
Block a user