[99s-extend] cowboy_rest : PUT and resource_exists vs is_conflict ?

Loïc Hoguin essen at ninenines.eu
Wed Aug 27 23:48:41 CEST 2014


For some callbacks you may need to check but only if you need to perform 
a different operation when it does/doesn't. For example if you write to 
files a PUT is the same operation either way, but if you write to an SQL 
DB you will want to do INSERT/UPDATE depending on that. Same goes for 
is_conflict and others, it depends.

So sometimes you need to keep that info around in the state and 
sometimes you don't.

On 08/28/2014 12:41 AM, Stéphane Wirtel wrote:
> Hi all,
>
> For the PUT method, the flow is
>
> resource_exists
> if method == PUT then go to the is_conflict function.
> In each function, we need to check if the resource already exists or not.
>
> I think we check twice, is it normal?
>
> Thank you,
>
> Stephane
>
> --
> Stéphane Wirtel - http://wirtel.be - @matrixise
> _______________________________________________
> Extend mailing list
> Extend at lists.ninenines.eu
> https://lists.ninenines.eu/listinfo/extend
>

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


More information about the Extend mailing list