Edgaras Karka
Edgaras Karka

Reputation: 7852

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

I have spring controller on the server:

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

Class AlgoRequest:

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

And AngularJS :

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

And when client sent request to server get Status 400 The request sent by the client was syntactically incorrect

Upvotes: 0

Views: 468

Answers (1)

chiastic-security
chiastic-security

Reputation: 20520

It's because 2.5 isn't an integer.

Your AlgoRequest class requires the limit field to be an integer, but you've tried to pass 2.5 in. It's syntactically incorrect because you haven't supplied a value that fits the syntax of an integer.

Upvotes: 0

Related Questions