Bad Request 400 -@RequestBody

2019-08-30 10:50发布

I am trying to send JSON :

{"source": "CED:100973626887874,CED:77148046400112,CED:222222222222201"}` 

and my Controller is as below:

@RequestMapping(value = "/multipleMember/list", method =RequestMethod.POST)
@ResponseBody
public List<MemberDetail> getMultipleMemberList(
        @RequestBody String memberList) {
    return memberServiceDelegate.getMultipleMemberList(memberList);
}

But I am getting bad request 400 : The request sent by the client was syntactically incorrect

2条回答
放我归山
2楼-- · 2019-08-30 11:52

perhaps your json object will need an object named memberList

{"memberList": "CED:100973626887874,CED:77148046400112,CED:222222222222201"}
查看更多
淡お忘
3楼-- · 2019-08-30 11:53

I believe you need to wrap your json with { } in order to indicate it is an object.

{
"source": "CED:100973626887874,CED:77148046400112,CED:222222222222201" 
}
查看更多
登录 后发表回答