发挥框架返回415(不支持的媒体类型)
问题描述:
大家好,我玩的框架应用程序返回发挥框架返回415(不支持的媒体类型)
415 (Unsupported Media Type)
帖子:对的ThOD看起来后
fetch(API_URL+'/process', {
method: "POST",
header: {"contentType": "application/json;charset=utf-8"},
body: JSON.stringify(newProcess)
});
控制器代码,如:
@BodyParser.Of(BodyParser.Json.class)
public Result createProcess(){
System.out.println("TEST");
System.out.println(request().body());
怎么了?
答
似乎你设置不正确的头小号,试试这个:
fetch(API_URL + '/process', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(newProcess)
});