spring boot backend FASTJSON, error code 415, 500

$.post({
url: "/register",
dataType: "json",
contentType: "application/json",
data: JSON.stringify(info),
success: function (data) {

}
});

It must contain:

dataType: "JSON",            
contentType: "file application / JSON", 415 without an error occurs rear

spring boot code is as follows
@PostMapping("/register")
    @ResponseBody
    public String register(@RequestBody JSONObject info) {
        return null
   }

Otherwise, you must add @RequestBody 500 errors

Guess you like

Origin www.cnblogs.com/destinymingyun/p/11026699.html