postman - 邮递员的回应是一个,但使用另一种工具 - 回应是另一个
问题描述
我有POST
要求:https://account.mail.ru/api/v1/user/signup
。当我使用它来获取它时,Postman
它可以正常工作:
请求(表单数据):
password=justpassword2281337
domain=mail.ru
name={"first":"firstName","last":"lastName"}
login=justlogin.any123
extended=true
响应(这是正确的响应):
{
"body": {
"additional": {},
"token": "token"
},
"status": 200,
"htmlencoded": false
}
但是,当我尝试使用 curl 时:
curl --location --request POST 'https://account.mail.ru/api/v1/user/signup' \
--form 'password="justpassword2281337"' \
--form 'domain="mail.ru"' \
--form 'name="{\"first\":\"firstName\",\"last\":\"lastName\"}"' \
--form 'login="justlogin.any123"' \
--form 'extended="true"'
响应(无效响应):
{
"body":{
"phones":{
"value":null,
"error":"required"
}
},
"email":null,
"status":400,
"htmlencoded":true
}
后端要我提供电话。
在此之后,我尝试了很多东西:
- 更改标题(Content-Type、User-Agent 等)
- 使用VPN,使用代理
- 设置cookies,删除cookies
- 试图在https://reqbin.com/中重复此请求
此外,我尝试使用原始请求重复此HTTP
请求。我为此使用了 BurpSuite 中继器实用程序。
原料HTTP
:
POST /api/v1/user/signup HTTP/1.1
User-Agent: PostmanRuntime/7.26.8
Accept: */*
Cache-Control: no-cache
Postman-Token: 2e8f4c93-45e7-4a6e-9485-84eea151223d
Host: account.mail.ru
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Type: multipart/form-data; boundary=--------------------------799760626318920619393512
Content-Length: 671
----------------------------799760626318920619393512
Content-Disposition: form-data; name="password"
justpassword2281337
----------------------------799760626318920619393512
Content-Disposition: form-data; name="domain"
mail.ru
----------------------------799760626318920619393512
Content-Disposition: form-data; name="name"
{"first":"firstName", last":"lastName"}
----------------------------799760626318920619393512
Content-Disposition: form-data; name="login"
justlogin.any123
----------------------------799760626318920619393512
Content-Disposition: form-data; name="extended"
true
----------------------------799760626318920619393512--
我也尝试使用newman
和postman-request
npm 库:
const request = require('postman-request');
request.post('https://account.mail.ru/api/v1/user/signup', {
form: {
password: 'justpassword2281337',
name: JSON.stringify({
first: "firstName",
last: "lastName"
}),
login: 'justlogin.any123',
domain: 'mail.ru',
extended: true
}
}, (err, res, body) => {
console.log(res, body)
})
const newman = require('newman')
newman.run({
collection: 'collection.json' // collection.json is exported from postman collection
}).on('request', function (error, data) {
if (error) {
console.error(error);
}
else console.log(data.response.stream.toString())
});
但是我所有的尝试都是徒劳的,后端给了我同样的回复,并要求我提供电话(
我认为Postman
发送请求与其他工具不同。
解决方案
推荐阅读
- python - cv::contourArea 中的 OpenCV 断言失败错误
- python - 如果第 1 列不包含列表中的任何子字符串,则将已清理的第 2 列合并到新列中
- docker - 如何增加/检查 Docker 在 Linux 上的默认内存?
- java - 无法删除搁置文件的 Perforce CL
- c - 如何遍历字符串并检查它是否与C中同一字符串的当前字符匹配?
- java - Spring autherization http 安全重定向,会话问题
- c - 将分配的堆释放给操作系统
- linux - 如何在带有美元($)符号的yocto中设置root密码
- javascript - 我如何知道数组对象中有多少具有不同日期或日期的数据
- javascript - 抽屉导航器内的堆栈导航器出现错误