postman传入对象和Map

传入对象的方法:

1.选择post方式
2.Headers里面
Key: Content-Type
Value: application/json
3.Body
选择raw
写入键值对

Example:
{“startdate”: “2018-07-01 00:00:00”,“enddate”: “2018-08-02 00:00:00”,“uniqueCode”: “”}

Postman传入多个参数,请求异常Required request body is missing

如需要传入一个String,一个List

输入参数后报错:@RequestBody对象为空,异常Required request body is missing

直接拦截了入参为空的请求,设置@RequestBody(required = false)后,将不会拦截,可以在后端进行判断

原因是两个参数都使用了@RequestBody接收,正确做法应该是分别使用@RequestParam(“id”),@RequestParam(“list”)指定参数

postman传入对象和Map_第1张图片

Map类型

Map

在Body中选择x-www-form-urlencoded的方式,将map中所需的key和value值输入即可

Map< String, List >

postman传入对象和Map_第2张图片

你可能感兴趣的:(postman传入对象和Map)