GET正常,POST获取不到数据

环境复现

        前台:

wx.request({
					url: 'xxxxxx',
					method: 'POST',
					header: {
						"content-type": "application/json"
					},
					success(res) {
						console.log(res);
						
					},
					fail(err) {

						console.error('网络请求失败', err);
					}
				});

        后端使用springboot:

@RequestMapping(value = "/errApiList")
public String getProductionPlanList(HttpServletRequest req, HttpServletResponse res) {
    String materialCode = req.getParameter("MaterialCode");
}

将请求方式换成GET,后端可以正常拿到数据,但是换成POST就拿不到。

解决方式:

更改请求头:"content-type": "application/x-www-form-urlencoded"

相关推荐

  1. GET正常POST获取数据

    2024-07-11 22:30:02       20 阅读
  2. 当go get获取软件包时

    2024-07-11 22:30:02       45 阅读
  3. Django获取post请求数据方式

    2024-07-11 22:30:02       39 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-11 22:30:02       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-11 22:30:02       72 阅读
  3. 在Django里面运行非项目文件

    2024-07-11 22:30:02       58 阅读
  4. Python语言-面向对象

    2024-07-11 22:30:02       69 阅读

热门阅读

  1. scoop安装在D盘

    2024-07-11 22:30:02       21 阅读
  2. 华为机考真题 -- 密码解密

    2024-07-11 22:30:02       19 阅读
  3. 设计模式——单例模式

    2024-07-11 22:30:02       21 阅读
  4. C# 反射

    2024-07-11 22:30:02       19 阅读
  5. Ubuntu 软件源404not found原因及解决办法

    2024-07-11 22:30:02       16 阅读
  6. 拓扑排序(算法篇)

    2024-07-11 22:30:02       23 阅读
  7. SQL 存储过程

    2024-07-11 22:30:02       24 阅读
  8. 大数据面试题之数据湖

    2024-07-11 22:30:02       21 阅读
  9. MySQL常用命令

    2024-07-11 22:30:02       17 阅读
  10. 多态

    多态

    2024-07-11 22:30:02      22 阅读
  11. 面向本科生的智能品牌传播策略优化

    2024-07-11 22:30:02       27 阅读
  12. 数字化转型

    2024-07-11 22:30:02       15 阅读