Grails REST with @Resource - PUT is not updating -
i'm learning grails (2.4.0) right , have weird problem automatically generated rest methods.
so, have simple domain
@resource(uri = '/unit', formats = ['json']) class unit { string name; }
i can list/create/delete instances get/post/delete methods, put method nothing:
curl -i -x put -h "content-type: application/json" -d '{"name":"fail", "id":65}' localhost:8080/app/unit/65 http/1.1 200 ok server: apache-coyote/1.1 location: http://localhost:8080/app/unit/65 content-type: application/json;charset=utf-8 transfer-encoding: chunked date: sun, 01 jun 2014 09:25:02 gmt {"class":"app.unit","id":65,"name":"test"}
subsequent requests return name:test instead of name:fail
what can doing wrong?
this bug relates updates (not newly created instances). have worked fix , have fix included in 2.4.1. see https://jira.grails.org/browse/grails-11462.
the short of updates being done request parameters, if request has body. fix change when update done, if request has body body used , if not, request parameters used.
sorry trouble , input.
Comments
Post a Comment