How to accept only post variables in grails

In my controller, I want to accept only POST variables, not GET Variables. As far as I know, Grails does not distinguish between POST and GET, although the request method can be checked using request.method, but I want to specifically accept only POST parameters. How to do it? Sorry if I sound too naive I just started groovy and grails with my background in PHP.

+4
source share
1 answer

Isn't that what allowedMethods block for

those. from the documentation:

 class PersonController { // action1 may be invoked via a POST // action2 has no restrictions // action3 may be invoked via a POST or DELETE static allowedMethods = [action1:'POST', action3:['POST', 'DELETE']] def action1 = { … } def action2 = { … } def action3 = { … } } 
+7
source

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


All Articles