<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Stefan,<div><br></div><div><br><div><div>On 14 Oct 2014, at 10:05, Stefan Strigler <<a href="mailto:stefan.strigler@gmail.com">stefan.strigler@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div>just subscribed yesterday and now that's already my first question.</div><div><br></div><div>I'm referring to <a href="http://ninenines.eu/docs/en/cowboy/1.0/guide/rest_flowcharts/">http://ninenines.eu/docs/en/cowboy/1.0/guide/rest_flowcharts/</a>. 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.</div></div></blockquote><div><br></div><div>This is correct, I have experience this behaviour on Cowboy 1.0.0 and 2.0.0-pre.1.</div><div><br></div><br><blockquote type="cite"><div dir="ltr"><div>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. </div></div></blockquote><div><br></div><div>Could you be more specific?</div><div>I’m afraid it is not how it works for me.</div><div><br></div><br><blockquote type="cite"><div dir="ltr"><div>But then I'm not totally sure how to interpret <a href="http://tools.ietf.org/html/rfc2616#section-10.2.2">http://tools.ietf.org/html/rfc2616#section-10.2.2</a> which states</div><div><br></div><div><pre class="" style="font-size: 1em; margin-top: 0px; margin-bottom: 0px;">   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.</pre><pre class="" style="font-size: 1em; margin-top: 0px; margin-bottom: 0px;"><br></pre><pre class="" style="font-size: 1em; margin-top: 0px; margin-bottom: 0px;"><span style="color:rgb(34,34,34);font-family:arial;white-space:normal;font-size:1em">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?</span><br></pre></div></div></blockquote><div><br></div></div>I think how Cowboy does is best at the moment.</div><div>I like to have the freedom to specify myself the Location, especially when PUT-ting <i>new</i> resources.</div><div><br></div><div><br></div><div>A bit off topic, I think this article is interesting regarding RFC-2616.</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">     </span><a href="https://www.mnot.net/blog/2014/06/07/rfc2616_is_dead">https://www.mnot.net/blog/2014/06/07/rfc2616_is_dead</a></div><div><br></div><div>Given that, you might want to have a look at RFC-7231, section 3.1.4.2:</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span><a href="http://tools.ietf.org/html/rfc7231#section-3.1.4.2">http://tools.ietf.org/html/rfc7231#section-3.1.4.2</a>.</div><div><br></div><div><br></div><div>Camille</div><div><br></div></body></html>