0%

postman接口测试记录

部门在用postman做接口测试,帮助同事解决了一些问题,自己也做个记录。

1.Postman 前置脚本预发送formdata请求

1
2
3
4
5
6
7
8
9
10
11
12
13
14
pm.sendRequest({
url: 'http://test.test.test/post',
method: 'POST',
header: {'Content-Type':'multipart/form-data'},
body: {
mode: 'formdata',
formdata: [
{key: "account", value:"hahaha", disabled: false, description: {content:"", type:"text/plain"}},
{key: "password", value: "xxxx", disabled: false, description: {content:"", type:"text/plain"}}
]
}
}, function (err, res) {
console.log(res);
});