Springboot:415 不支持的媒体类型

问题描述

这些是我的标题Headers

这个错误突然出现。我已经有一段时间没有错误地向我的应用程序发送 POST 请求了。我的 Post 方法如下:

控制器:

 @PostMapping(path = "/generateCredential",consumes="multipart/form-data")
 @ApiOperation(value = "User can register using this Api",response = RegisterForPluginResponse.class)
 public ResponseEntity<Object> generateCredential(@Valid @RequestBody RegisterForPluginRequest registerForPlugin) {
  ...
 }

dto:

 public RegisterForPluginRequest() {
        super();
    }
 public RegisterForPluginRequest(@Email @NotEmpty String clientName,@NotEmpty int packageId,String phone,String email) {
        super();
        this.clientName = clientName;
        this.packageId = packageId;
        this.phone = phone;
        this.email = email;
    }

什么会导致之前没有的 415 错误?我最近确实通过添加 2 列来更改应用程序的 sql 表,不知道这是否可能是我的问题的根源?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)