Postman发送 空请求体 Post请求的方法
有一个post api,调用方式是这样的
https://xxx.cn/a/b/c/Collector/collectors?pageIndex=1&pageSize=10
在swagger中的调用时是这样的:
然后,我直接把Request URL复制到Postman中,点击Send,返回以下错误
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.13",
"title": "Unsupported Media Type",
"status": 415,
"traceId": "00-c48c458b5d275743ae14d53adffd79de-921f7e7b0554ad4b-00"
}
网上查了下,需要在Headers中添加content-type:application/json。加上之后,错误变了:
{
"errors": {
"": [
"A non-empty request body is required."
]
},
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"traceId": "00-79c691b196746d4991dc3e6ed96f5530-9e607629b09ef14e-00"
}
错误说明需要添加一个空的请求体,根据提示修改。在Body中,选择raw,输入{},再Send即可。