简体   繁体   中英

Grails 2.0.0: HTTP status 302

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM