測試接口報(bào)了這個(gè)問題:Required request body is missing。因?yàn)槲沂褂玫氖荊ET請(qǐng)求 然后controller中的方法接收的參數(shù)使用了@RequestBody 注解 例如:會(huì)報(bào)Required request body is missing
@GetMapping("/list")
public ResponseResult list(@RequestBody MenuDto menuDto){
return menuService.list(menuDto);
}
因?yàn)镚et請(qǐng)求發(fā)送數(shù)據(jù)的方式不是json格式,所以當(dāng)我們使@RequsetBody封裝Get請(qǐng)求的數(shù)據(jù)時(shí)就會(huì)出現(xiàn)無法獲取到數(shù)據(jù)的情況 解決方法: 1.使用POST請(qǐng)求 2.將@RequestBody 注解去掉即可
Required request body is missing 錯(cuò)誤解決_G_whang的博客-CSDN博客?文章來源地址http://www.zghlxwxcb.cn/news/detail-733412.html
文章來源:http://www.zghlxwxcb.cn/news/detail-733412.html
到了這里,關(guān)于Required request body is missing 錯(cuò)誤解決的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!