Peter Ledbrook
2014-02-13 14:52:50 UTC
Hi,
I've been delving into some of the code behind the REST support and
noticed a couple of status codes that don't seem quite right to me.
The first is the use of 404 for a read-only resource:
https://github.com/grails/grails-core/blob/master/grails-plugin-rest/src/main/groovy/grails/rest/RestfulController.groovy#L194
Surely that should be a 405 as the resource exists but doesn't support
POST, PUT or DELETE.
The other questionable status code is 415 when an appropriate renderer
can't be found for a particular resource:
https://github.com/grails/grails-core/blob/master/grails-plugin-rest/src/main/groovy/org/grails/plugins/web/rest/api/ControllersRestApi.groovy#L162
According to the spec, 415 (Unsupported Media Type) only applies if
the server can't deal with the *request* content type. I think 406
(Not Acceptable) is more appropriate, although even that's not ideal.
Thoughts?
Peter
I've been delving into some of the code behind the REST support and
noticed a couple of status codes that don't seem quite right to me.
The first is the use of 404 for a read-only resource:
https://github.com/grails/grails-core/blob/master/grails-plugin-rest/src/main/groovy/grails/rest/RestfulController.groovy#L194
Surely that should be a 405 as the resource exists but doesn't support
POST, PUT or DELETE.
The other questionable status code is 415 when an appropriate renderer
can't be found for a particular resource:
https://github.com/grails/grails-core/blob/master/grails-plugin-rest/src/main/groovy/org/grails/plugins/web/rest/api/ControllersRestApi.groovy#L162
According to the spec, 415 (Unsupported Media Type) only applies if
the server can't deal with the *request* content type. I think 406
(Not Acceptable) is more appropriate, although even that's not ideal.
Thoughts?
Peter
--
Peter Ledbrook
t: @pledbrook
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
Peter Ledbrook
t: @pledbrook
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email