Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported]
时间: 2023-08-31 07:13:14 浏览: 107
浅析application/x-www-form-urlencoded和multipart/form-data的区别
这个错误是由于前端传来的参数的Content-Type设置为"application/x-www-form-urlencoded;charset=UTF-8",而后端不支持这种类型的数据。\[1\]通常情况下,当Content-Type设置为"application/x-www-form-urlencoded;charset=UTF-8"时,无论是POST请求还是GET请求,都可以成功获取参数。但是,如果前端的POST请求中的body是Json对象的话,就会报错。\[2\]这是因为"application/x-www-form-urlencoded"类型的数据是以键值对的形式发送到后端的,而Json对象的格式与之不符。\[3\]所以,当前端使用Json对象作为请求体时,应该将Content-Type设置为"application/json",以便后端正确解析数据。
#### 引用[.reference_title]
- *1* [关于出现“Content type ‘application/x-www-form-urlencoded;charset=UTF-8‘ not supported“问题如何...](https://blog.csdn.net/LoveTrainHY/article/details/122405744)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [Content type ‘application/x-www-form-urlencoded;charset=UTF-8‘ not supported](https://blog.csdn.net/qq_42859450/article/details/122585906)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [Content type ‘application/x-www-form-urlencoded;charset=UTF-8‘ not supported“【已解决】](https://blog.csdn.net/qq_45796667/article/details/125226309)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文