Required request body is missing
阿新 • • 發佈:2021-01-20
Required request body is missing
錯誤程式碼:
@GetMapping("/topic/message/list")
public ApiResult<List<AppMessage>> getTopicMessageList(@Validated @RequestBody AppTopicMessageParm topicMessageParm){
return ApiResult.ok(messageService.getTopicMessageList(topicMessageParm. getTopicId()));
}
RequestBody接受json格式的資料,Get請求傳送資料格式並不是json格式。解決方法:將@RequestBody註解去掉即可。
@GetMapping("/topic/message/list")
public ApiResult<List<AppMessage>> getTopicMessageList(@Validated AppTopicMessageParm topicMessageParm){
return ApiResult.ok(messageService.getTopicMessageList (topicMessageParm.getTopicId()));
}