mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-20 07:40:32 +08:00
fix: post form data
This commit is contained in:
@@ -100,7 +100,10 @@
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"url": "/post",
|
||||
"params": {
|
||||
"headers": {
|
||||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
|
||||
},
|
||||
"body": {
|
||||
"foo1": "$varFoo1",
|
||||
"foo2": "${max($a, $b)}"
|
||||
}
|
||||
|
||||
@@ -67,7 +67,9 @@ teststeps:
|
||||
request:
|
||||
method: POST
|
||||
url: /post
|
||||
params:
|
||||
headers:
|
||||
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
|
||||
body:
|
||||
foo1: $varFoo1
|
||||
foo2: ${max($a, $b)}
|
||||
validate:
|
||||
|
||||
@@ -49,6 +49,7 @@ func TestCaseDemo(t *testing.T) {
|
||||
AssertEqual("body.json.foo2", 12.3, "check args foo2"),
|
||||
hrp.Step("post form data").
|
||||
POST("/post").
|
||||
WithHeaders(map[string]string{"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"}).
|
||||
WithParams(map[string]interface{}{
|
||||
"foo1": "$varFoo1", // reference former extracted variable
|
||||
"foo2": "${max($a, $b)}", // 12.3; step level variables are independent, variable b is 3.45 here
|
||||
|
||||
Reference in New Issue
Block a user