[99s-extend] How to use the PUT verb with Cowboy_Rest ?

Stéphane Wirtel stephane at wirtel.be
Sun Aug 24 02:22:22 CEST 2014


resource_exists is used by POST
is_conflict is used by PUT (from the code)
but in the case where my database already exists, I need to return 412 
and not 409.

and I know I don't respect the default value returned by Cowboy_rest.

On 24 Aug 2014, at 2:16, Daniel Goertzen wrote:

> You should implement the resource_exists() callback; this will let the 
> rest
> module pick a 200 vs 201.  If the db name was incorrect, I think you 
> are
> just supposed to return false from the put callback.  I can't remember 
> the
> http code for that case.
>
> Regards,
> Dan.
>
>
> On Sat, Aug 23, 2014 at 6:58 PM, Stéphane Wirtel <stephane at wirtel.be> 
> wrote:
>
>> Hi all,
>>
>> 1. I would like to use the cowboy_rest protocol with cowboy 1.0 but I 
>> have
>> a small crash.
>>
>> Here is my code:
>>
>> https://www.friendpaste.com/7O3X4fG4u31gBg9MgW5xg4
>>
>> Could you tell me if I correctly use cowboy_rest for the PUT verb? I 
>> have
>> seen is_conflict/2, but I don't know how to use it.
>>
>> 2. I would like to change the response code, but I get the error. Is 
>> it
>> possible?
>>
>> Thank you.
>>
>> Regards,
>>
>> Stephane
>>
>> --
>> Stéphane Wirtel - http://wirtel.be - @matrixise
>> _______________________________________________
>> Extend mailing list
>> Extend at lists.ninenines.eu
>> https://lists.ninenines.eu/listinfo/extend
>>


--
Stéphane Wirtel - http://wirtel.be - @matrixise


More information about the Extend mailing list