[99s-extend] I need your feedback about this cowboy_rest handler.

Loïc Hoguin essen at ninenines.eu
Wed Aug 27 12:53:19 CEST 2014


>>> * for PUT, how I have a 201? I have read the rest_flowchart and I need
>>> to specify the location header ok, but where? in the is_conflict
>>> function?
>>
>> Why do you need a 201? If you PUT a collection to /:collection then
>> this is already the location of the collection. I am not sure what you
>> are trying to do there exactly?
> In this case, the PUT method is used for the creation of the resource
> and not for the update. This is the reason of the 201 status code.
>
> In the rest_flowchart graph for the PUT/POST methods, what is the node
> "new resource" ? Is it just the {true, Req, State} from the callback
> defined in the content_types_accepted?
>
> PS: I retested and now, I have my 201 with PUT, just resource_exists has
> to return false and not true ;-)

My bad I was a little confusing in my previous answer. You are right, if 
the resource doesn't exist and PUT is used we get a 201 automatically. 
The location header must only be provided if the resource was created 
elsewhere.

-- 
Loïc Hoguin
http://ninenines.eu


More information about the Extend mailing list