mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-07 23:41:22 +08:00
feat: add code for network error
This commit is contained in:
@@ -14,6 +14,7 @@ const (
|
|||||||
var (
|
var (
|
||||||
ConfigureError = errors.New("configure error") // 3
|
ConfigureError = errors.New("configure error") // 3
|
||||||
UnauthorizedError = errors.New("unauthorized error") // 4
|
UnauthorizedError = errors.New("unauthorized error") // 4
|
||||||
|
NetworkError = errors.New("network error") // 5
|
||||||
InvalidPython3Venv = errors.New("prepare python3 venv failed") // 9
|
InvalidPython3Venv = errors.New("prepare python3 venv failed") // 9
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -114,6 +115,7 @@ var errorsMap = map[error]int{
|
|||||||
// environment
|
// environment
|
||||||
ConfigureError: 3,
|
ConfigureError: 3,
|
||||||
UnauthorizedError: 4,
|
UnauthorizedError: 4,
|
||||||
|
NetworkError: 5,
|
||||||
InvalidPython3Venv: 9,
|
InvalidPython3Venv: 9,
|
||||||
|
|
||||||
// loader
|
// loader
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
v5.0.0-beta-2409201812
|
v5.0.0-beta-2409211833
|
||||||
@@ -73,10 +73,10 @@ type Driver struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DriverResult struct {
|
type DriverResult struct {
|
||||||
RequestUrl string `json:"request_driver_url"`
|
RequestUrl string `json:"request_driver_url"`
|
||||||
RequestBody string `json:"request_driver_body,omitempty"`
|
RequestBody string `json:"request_driver_body,omitempty"`
|
||||||
RequestDuration time.Duration `json:"request_driver_duration"`
|
RequestDuration int64 `json:"request_driver_duration(ms)"` // ms
|
||||||
RequestTime time.Time `json:"request_driver_time"`
|
RequestTime time.Time `json:"request_driver_time"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wd *Driver) concatURL(u *url.URL, elem ...string) string {
|
func (wd *Driver) concatURL(u *url.URL, elem ...string) string {
|
||||||
@@ -133,7 +133,7 @@ func (wd *Driver) httpRequest(method string, rawURL string, rawBody []byte) (raw
|
|||||||
driverResult := &DriverResult{
|
driverResult := &DriverResult{
|
||||||
RequestUrl: rawURL,
|
RequestUrl: rawURL,
|
||||||
RequestBody: string(rawBody),
|
RequestBody: string(rawBody),
|
||||||
RequestDuration: duration,
|
RequestDuration: duration.Milliseconds(),
|
||||||
RequestTime: time.Now(),
|
RequestTime: time.Now(),
|
||||||
}
|
}
|
||||||
wd.session.addRequestResult(driverResult)
|
wd.session.addRequestResult(driverResult)
|
||||||
|
|||||||
Reference in New Issue
Block a user