簡體   English   中英

狀態400客戶端發送的請求在語法上不正確。 AngularJS http

[英]Status 400 The request sent by the client was syntactically incorrect. Angularjs http

我在服務器上有spring控制器:

@RequestMapping(value = "/lab/getAlgo", method = RequestMethod.POST)
    public @ResponseBody Algo14web  getPicksByLeague(@RequestBody AlgoRequest request) {
    ...

類AlgoRequest:

class AlgoRequest{
        public int id;
        public int limit; // I tried change to double and float too
    }

和AngularJS:

$http.post(urlSer.url+"lab/getAlgo",{id:1,limit:2.5});

並且當客戶端向服務器發送請求時獲得Status 400 The request sent by the client was syntactically incorrect客戶端發送的請求Status 400 The request sent by the client was syntactically incorrect

這是因為2.5不是整數。

您的AlgoRequest類要求limit字段為整數,但是您嘗試傳遞2.5 in。在語法上是錯誤的,因為您沒有提供適合整數語法的值。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM