Fork me on GitHub
#yada
<
2017-06-05
>
delitescere04:06:57

Hi Malcolm. I’m enjoying yada and the philosophy - thanks to you and the juxt team for a principled tool that bundles a nice choice of libraries!

delitescere04:06:45

On the matter of the philosophical side of things: I found it a little odd that the response to a POST is 303. In my journeys with using strict HTTP semantics, I’ve tended to use a 201 if the request caused a resource to be created. Along with the 201 would come a Location header with the canonical URL of the newly minted resource. A response entity may also be in the response, and if so, probably the same thing a GET on the aforementioned resource would return (hopefully including some HAL-like links). The requesting party would then be happy with the 2xx status and follow the Location header (or parse the response entity for other links to follow). When the requesting party is a browser, though, the browsers don’t follow Location headers on 2xx status - and this is a pity (for it has lead to the POST-redirect-GET pattern). However, browsers do respect Refresh headers. So there is no harm in including a Refresh: 0; <url> along with a Location: <url> in the response. This will then work for both pure HTML web applications and XHR-based ones, as well as machine requesters. You can test for yourself at http://www.mocky.io/v2/5934d70410000076073ee7fb which returns a 201 status, but where your browser will still end up at the Google. Thoughts?