在邮递员脚本中发送 Post 请求
Sending a Post request in postman pre-script
我正在尝试使用邮递员在预脚本中发送 POST 请求,但出现错误 "There was an error in evaluating the Pre-request Script: Error: Unexpected token '<' at 1:1 ^"。不知道怎么了。谁能帮我解决这个问题?
pm.sendRequest({
url: 'http://localhost:8001/routes/d6b7a95a-fd91-4f8a-b8f6-10835f30170a',
method: 'PATCH',
headers: {"Content-Type": "application/json"},
body: {
mode: 'raw',
raw:JSON.stringify({
"protocols":["http","https"],
"paths":["/target-paymentoriginal"],
"methods":[]})} },
function (err, response) { console.log("Updated original route to target-payment"+response.json()); });
指定 headers
的密钥不正确。
应该是:
header: {"Content-Type": "application/json"}
-
您需要从代码中删除 s
。
我正在尝试使用邮递员在预脚本中发送 POST 请求,但出现错误 "There was an error in evaluating the Pre-request Script: Error: Unexpected token '<' at 1:1 ^"。不知道怎么了。谁能帮我解决这个问题?
pm.sendRequest({
url: 'http://localhost:8001/routes/d6b7a95a-fd91-4f8a-b8f6-10835f30170a',
method: 'PATCH',
headers: {"Content-Type": "application/json"},
body: {
mode: 'raw',
raw:JSON.stringify({
"protocols":["http","https"],
"paths":["/target-paymentoriginal"],
"methods":[]})} },
function (err, response) { console.log("Updated original route to target-payment"+response.json()); });
指定 headers
的密钥不正确。
应该是:
header: {"Content-Type": "application/json"}
-
您需要从代码中删除 s
。