fix: change Validators type, check json body format

This commit is contained in:
buyuxiang
2022-03-01 18:05:13 +08:00
parent 31e2fb61de
commit 11448faed0
7 changed files with 40 additions and 26 deletions

View File

@@ -42,7 +42,7 @@ func TestRunRequestGetToStruct(t *testing.T) {
if tStep.Request.Cookies["user"] != "debugtalk" {
t.Fatalf("tStep.Request.Cookies mismatch")
}
if tStep.Validators[0].Check != "status_code" || tStep.Validators[0].Expect != 200 {
if validator, ok := tStep.Validators[0].(Validator); !ok || validator.Check != "status_code" || validator.Expect != 200 {
t.Fatalf("tStep.Validators mismatch")
}
}
@@ -67,7 +67,7 @@ func TestRunRequestPostDataToStruct(t *testing.T) {
if tStep.Request.Body != "a=1&b=2" {
t.Fatalf("tStep.Request.Data mismatch")
}
if tStep.Validators[0].Check != "status_code" || tStep.Validators[0].Expect != 200 {
if validator, ok := tStep.Validators[0].(Validator); !ok || validator.Check != "status_code" || validator.Expect != 200 {
t.Fatalf("tStep.Validators mismatch")
}
}