summaryrefslogblamecommitdiffstats
path: root/archives/extend/2014-August/000442.html
blob: 5c15d7666e6ca642097e79732e88d75337fc3948 (plain) (tree)






































































































































                                                                                                                                                                                                                                 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
 <HEAD>
   <TITLE> [99s-extend] How to use the PUT verb with Cowboy_Rest ?
   </TITLE>
   <LINK REL="Index" HREF="index.html" >
   <LINK REL="made" HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20How%20to%20use%20the%20PUT%20verb%20with%20Cowboy_Rest%20%3F&In-Reply-To=%3C864BDA07-F0F6-43A3-8D6C-12056DFE6C5E%40wirtel.be%3E">
   <META NAME="robots" CONTENT="index,nofollow">
   <style type="text/css">
       pre {
           white-space: pre-wrap;       /* css-2.1, curent FF, Opera, Safari */
           }
   </style>
   <META http-equiv="Content-Type" content="text/html; charset=us-ascii">
   <LINK REL="Previous"  HREF="000441.html">
   <LINK REL="Next"  HREF="000443.html">
 </HEAD>
 <BODY BGCOLOR="#ffffff">
   <H1>[99s-extend] How to use the PUT verb with Cowboy_Rest ?</H1>
    <B>Stephane Wirtel</B> 
    <A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20How%20to%20use%20the%20PUT%20verb%20with%20Cowboy_Rest%20%3F&In-Reply-To=%3C864BDA07-F0F6-43A3-8D6C-12056DFE6C5E%40wirtel.be%3E"
       TITLE="[99s-extend] How to use the PUT verb with Cowboy_Rest ?">stephane at wirtel.be
       </A><BR>
    <I>Sun Aug 24 02:52:58 CEST 2014</I>
    <P><UL>
        <LI>Previous message: <A HREF="000441.html">[99s-extend] How to use the PUT verb with Cowboy_Rest ?
</A></li>
        <LI>Next message: <A HREF="000443.html">[99s-extend] Full example of cowboy_rest?
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#442">[ date ]</a>
              <a href="thread.html#442">[ thread ]</a>
              <a href="subject.html#442">[ subject ]</a>
              <a href="author.html#442">[ author ]</a>
         </LI>
       </UL>
    <HR>  
<!--beginarticle-->
<PRE>Ok I will try asap, thanks

&gt;<i> On 24 ao&#251;t 2014, at 02:25 AM, Eduardo Gurgel &lt;<A HREF="https://lists.ninenines.eu/listinfo/extend">edgurgel at gmail.com</A>&gt; wrote:
</I>&gt;<i> 
</I>&gt;<i> I think you can always halt the processing and do the reply by yourself:
</I>&gt;<i> 
</I>&gt;<i> {ok, Req2} = cowboy_req:reply(412, Req),
</I>&gt;<i> {halt, Req2, State}.
</I>&gt;<i> 
</I>&gt;<i> 
</I>&gt;&gt;<i> On Sun, Aug 24, 2014 at 12:22 PM, St&#233;phane Wirtel &lt;<A HREF="https://lists.ninenines.eu/listinfo/extend">stephane at wirtel.be</A>&gt; wrote:
</I>&gt;&gt;<i> resource_exists is used by POST
</I>&gt;&gt;<i> is_conflict is used by PUT (from the code)
</I>&gt;&gt;<i> but in the case where my database already exists, I need to return 412 and not 409.
</I>&gt;&gt;<i> 
</I>&gt;&gt;<i> and I know I don't respect the default value returned by Cowboy_rest.
</I>&gt;&gt;<i> 
</I>&gt;&gt;<i> 
</I>&gt;&gt;<i> On 24 Aug 2014, at 2:16, Daniel Goertzen wrote:
</I>&gt;&gt;<i> 
</I>&gt;&gt;&gt;<i> You should implement the resource_exists() callback; this will let the rest
</I>&gt;&gt;&gt;<i> module pick a 200 vs 201.  If the db name was incorrect, I think you are
</I>&gt;&gt;&gt;<i> just supposed to return false from the put callback.  I can't remember the
</I>&gt;&gt;&gt;<i> http code for that case.
</I>&gt;&gt;&gt;<i> 
</I>&gt;&gt;&gt;<i> Regards,
</I>&gt;&gt;&gt;<i> Dan.
</I>&gt;&gt;&gt;<i> 
</I>&gt;&gt;&gt;<i> 
</I>&gt;&gt;&gt;<i> On Sat, Aug 23, 2014 at 6:58 PM, St&#233;phane Wirtel &lt;<A HREF="https://lists.ninenines.eu/listinfo/extend">stephane at wirtel.be</A>&gt; wrote:
</I>&gt;&gt;&gt;<i> 
</I>&gt;&gt;&gt;&gt;<i> Hi all,
</I>&gt;&gt;&gt;&gt;<i> 
</I>&gt;&gt;&gt;&gt;<i> 1. I would like to use the cowboy_rest protocol with cowboy 1.0 but I have
</I>&gt;&gt;&gt;&gt;<i> a small crash.
</I>&gt;&gt;&gt;&gt;<i> 
</I>&gt;&gt;&gt;&gt;<i> Here is my code:
</I>&gt;&gt;&gt;&gt;<i> 
</I>&gt;&gt;&gt;&gt;<i> <A HREF="https://www.friendpaste.com/7O3X4fG4u31gBg9MgW5xg4">https://www.friendpaste.com/7O3X4fG4u31gBg9MgW5xg4</A>
</I>&gt;&gt;&gt;&gt;<i> 
</I>&gt;&gt;&gt;&gt;<i> Could you tell me if I correctly use cowboy_rest for the PUT verb? I have
</I>&gt;&gt;&gt;&gt;<i> seen is_conflict/2, but I don't know how to use it.
</I>&gt;&gt;&gt;&gt;<i> 
</I>&gt;&gt;&gt;&gt;<i> 2. I would like to change the response code, but I get the error. Is it
</I>&gt;&gt;&gt;&gt;<i> possible?
</I>&gt;&gt;&gt;&gt;<i> 
</I>&gt;&gt;&gt;&gt;<i> Thank you.
</I>&gt;&gt;&gt;&gt;<i> 
</I>&gt;&gt;&gt;&gt;<i> Regards,
</I>&gt;&gt;&gt;&gt;<i> 
</I>&gt;&gt;&gt;&gt;<i> Stephane
</I>&gt;&gt;&gt;&gt;<i> 
</I>&gt;&gt;&gt;&gt;<i> --
</I>&gt;&gt;&gt;&gt;<i> St&#233;phane Wirtel - <A HREF="http://wirtel.be">http://wirtel.be</A> - @matrixise
</I>&gt;&gt;&gt;&gt;<i> _______________________________________________
</I>&gt;&gt;&gt;&gt;<i> Extend mailing list
</I>&gt;&gt;&gt;&gt;<i> <A HREF="https://lists.ninenines.eu/listinfo/extend">Extend at lists.ninenines.eu</A>
</I>&gt;&gt;&gt;&gt;<i> <A HREF="https://lists.ninenines.eu/listinfo/extend">https://lists.ninenines.eu/listinfo/extend</A>
</I>&gt;&gt;<i> 
</I>&gt;&gt;<i> 
</I>&gt;&gt;<i> --
</I>&gt;&gt;<i> St&#233;phane Wirtel - <A HREF="http://wirtel.be">http://wirtel.be</A> - @matrixise
</I>&gt;&gt;<i> _______________________________________________
</I>&gt;&gt;<i> Extend mailing list
</I>&gt;&gt;<i> <A HREF="https://lists.ninenines.eu/listinfo/extend">Extend at lists.ninenines.eu</A>
</I>&gt;&gt;<i> <A HREF="https://lists.ninenines.eu/listinfo/extend">https://lists.ninenines.eu/listinfo/extend</A>
</I>&gt;<i> 
</I>&gt;<i> 
</I>&gt;<i> 
</I>&gt;<i> -- 
</I>&gt;<i> Eduardo
</I>-------------- next part --------------
An HTML attachment was scrubbed...
URL: &lt;<A HREF="http://lists.ninenines.eu/archives/extend/attachments/20140824/f35e1e51/attachment.html">http://lists.ninenines.eu/archives/extend/attachments/20140824/f35e1e51/attachment.html</A>&gt;
</PRE>


<!--endarticle-->
    <HR>
    <P><UL>
        <!--threads-->
	<LI>Previous message: <A HREF="000441.html">[99s-extend] How to use the PUT verb with Cowboy_Rest ?
</A></li>
	<LI>Next message: <A HREF="000443.html">[99s-extend] Full example of cowboy_rest?
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#442">[ date ]</a>
              <a href="thread.html#442">[ thread ]</a>
              <a href="subject.html#442">[ subject ]</a>
              <a href="author.html#442">[ author ]</a>
         </LI>
       </UL>

<hr>
<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend
mailing list</a><br>
</body></html>