2017-04-19 102 views
0

大家好,我玩的框架應用程序返回發揮框架返回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()); 

怎麼了?

回答

2

似乎你設置不正確的頭小號,試試這個:

fetch(API_URL + '/process', { 
    method: 'POST', 
    headers: { 'Content-Type': 'application/json' }, 
    body: JSON.stringify(newProcess) 
}); 
相關問題