Grails "params" does not contain json payload for REST controllers

I am writing a REST API for my application.

Using the JSON payload in a POST request:

{
   availableAfter: "2014-03-16"
   canRead: true
   rightName: "dsa"
}

The problem is that there are no payload values โ€‹โ€‹in the controller parameters. But despite this, I can read them using syntax properties[*], for example:

right.properties['rightName', 'canRead'] = params;
right.availableAfter = params.date('availableAfter', 'yyyy-MM-dd');

The properties "rightName" and "canRead" are set in order. "availableAfter" is not equal (null, even if it is done using params.availableAfter).

Why is he different?

UPDATE: Grails v 2.3.6

+4
source share
1 answer

request.JSON, JSON-. params , JSON .

+5

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


All Articles