zoukankan      html  css  js  c++  java
  • springboot 报错Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported

    项目默认使用POST方式提交json字符串:

        public RestResponse statusChange(@RequestBody Map<String, Object> params) {
            if(params == null){
                params = new HashMap<>();
            }
            return RestResponse.success();
        }

    但是在接入其他厂商接口时,对方的数据格式是:

    Content-Type: application/x-www-form-urlencoded

    导致推送的数据无法获取,查询资料(Google)得知,这种数据格式key=value格式拼接的数据,可以使用@RequestParam获取数据

        public RestResponse statusChange(@RequestParam Map<String, Object> params) {
            if(params == null){
                params = new HashMap<>();
            }
            return RestResponse.success();
        }
  • 相关阅读:
    接口内容小结
    接口的静态方法与私有方法
    接口的默认方法
    发红包O
    抽象
    《大道至简》读后感
    重写
    继承中的二义性问题
    数学应用
    继承
  • 原文地址:https://www.cnblogs.com/yangjiming/p/11912255.html
Copyright © 2011-2022 走看看