Reputation: 860
I have a controller which allows only POST for certain actions:
static allowedMethods = [save: "POST", update: "POST", delete: "POST"]
Then there's a test for it:
void testUpdateWithGet() {
controller.update()
assert response.status == HttpServletResponse.SC_METHOD_NOT_ALLOWED
}
This worked fine with 2.0.0.RC1 but after upgrading to Grails 2.0.0 final release the returned status in the response is 302
. Why is that?
Regards
Jonas
Upvotes: 0
Views: 912
Reputation: 3723
I can confirm your test case. It's because since 2.0.0.RC3 Grails has unresolved bug that affects 2.0.0 final too: http://jira.grails.org/browse/GRAILS-8426 - Allowed methods are not respected in unit tests. You can downgrade to 2.0.0.RC1 or wait for this bug to be fixed. It only affects unit tests, but works fine in application.
Upvotes: 3