Problems with the map in the game (400 bad requests)

I'm having trouble sending POST to the playback platform - it may not even be Play related, just like HTTP related.

$.ajax({ type:'POST', url:'http://localhost:9000/start', data: { myJson:JSON.stringify(arg) } }).done(function(data) { console.log(data); }); 

where arg is an array of strings, that is: ['a', 'b', 'c']

The route I'm trying to use to fix this:

 POST /start controllers.Application.startIt(myJson) 

What am I doing wrong? At the moment (if the route runs correctly), this function will never return 400. There is no way out to the Play console, only javascript:

POST http://localhost:9000/start 400 (Bad Request)

+4
source share
1 answer

The documentation explains when the BadRequest error code is returned within the framework. The problem arises from the file of your router. You define a route / start that initiates a call to the startIt method, but the method has an argument, and the structure does not know what value it must pass.

To handle JSON requests correctly, see the highlighted part of the documentation .

+2
source

Source: https://habr.com/ru/post/1442825/


All Articles