[99s-extend] PUT on new resource and status 201

Stefan Strigler stefan.strigler at gmail.com
Tue Oct 14 10:05:53 CEST 2014


Hey,

just subscribed yesterday and now that's already my first question.

I'm referring to
http://ninenines.eu/docs/en/cowboy/1.0/guide/rest_flowcharts/. Given you
have a PUT on a new resource the diagram suggests that the response's
status code depends on whether you've set a location and/or body. But when
looking at the code (v1.0.0) then cowboy_rest:maybe_created/2 would always
return a 201. No matter what. I think the code is right, but the diagram
needs to be fixed.

But then I'm not totally sure how to interpret
http://tools.ietf.org/html/rfc2616#section-10.2.2 which states

   The newly created resource can be referenced by the URI(s)
   returned in the entity of the response, with the most specific URI
   for the resource given by a Location header field.


Because currently it is totally possible to not have a location header
set (just as no body) for the response. In my opinion the current code
behaves good enough and it's up to the service to ensure the
requirements as stated by the RFC. Should cowboy enforce a header
field? Should it try to figure that out on its own?


Regards,


Stefan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ninenines.eu/archives/extend/attachments/20141014/d89bced6/attachment.html>


More information about the Extend mailing list