Postman发送 空请求体 Post请求的方法

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即可。
在这里插入图片描述

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值