summaryrefslogblamecommitdiffstats
path: root/archives/extend/2014-August/000446.html
blob: c53453238461a2a4cb1d5667031f67e907d8ab58 (plain) (tree)


































































































                                                                                                                                                                                                         
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
 <HEAD>
   <TITLE> [99s-extend] cowboy_rest and delete_completed and response
   </TITLE>
   <LINK REL="Index" HREF="index.html" >
   <LINK REL="made" HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20cowboy_rest%20and%20delete_completed%20and%20response&In-Reply-To=%3C53FD0441.1070701%40ninenines.eu%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="000445.html">
   <LINK REL="Next"  HREF="000447.html">
 </HEAD>
 <BODY BGCOLOR="#ffffff">
   <H1>[99s-extend] cowboy_rest and delete_completed and response</H1>
    <B>Lo&#239;c Hoguin</B> 
    <A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20cowboy_rest%20and%20delete_completed%20and%20response&In-Reply-To=%3C53FD0441.1070701%40ninenines.eu%3E"
       TITLE="[99s-extend] cowboy_rest and delete_completed and response">essen at ninenines.eu
       </A><BR>
    <I>Wed Aug 27 00:03:45 CEST 2014</I>
    <P><UL>
        <LI>Previous message: <A HREF="000445.html">[99s-extend] cowboy_rest and delete_completed and response
</A></li>
        <LI>Next message: <A HREF="000447.html">[99s-extend] cowboy_rest and delete_completed and response
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#446">[ date ]</a>
              <a href="thread.html#446">[ thread ]</a>
              <a href="subject.html#446">[ subject ]</a>
              <a href="author.html#446">[ author ]</a>
         </LI>
       </UL>
    <HR>  
<!--beginarticle-->
<PRE>Call cowboy_req:meta(media_type, Req) to retrieve it.

On 08/27/2014 12:59 AM, St&#233;phane Wirtel wrote:
&gt;<i> Hi all,
</I>&gt;<i>
</I>&gt;<i> I work with two content-types (json, msgpack).
</I>&gt;<i>
</I>&gt;<i> In the DELETE verb, I need to return an object and in this case, I work
</I>&gt;<i> on delete_resource/2 and delete_completed/2.
</I>&gt;<i> The problem is, how can I return a body in function of the content-type?
</I>&gt;<i> because after delete_completed, there is a call to the
</I>&gt;<i> cowboy_rest:has_resp_body function and I need to set the body of the
</I>&gt;<i> response.
</I>&gt;<i>
</I>&gt;<i> delete_completed(Req, State) -&gt;
</I>&gt;<i>      Body = Json or MsgPack ?  &lt;-- Which content ?
</I>&gt;<i>
</I>&gt;<i>      Req2 = cowboy_req:set_resp_body(Body, Req),
</I>&gt;<i>      {true, Req2, State}.
</I>&gt;<i>
</I>&gt;<i> Ok, but in this case, what's the reason of content_types_provided/2 and
</I>&gt;<i> content_types_accepted/2 ?
</I>&gt;<i>
</I>&gt;<i> Thank you,
</I>&gt;<i>
</I>&gt;<i> Stephane
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i> --
</I>&gt;<i> St&#233;phane Wirtel - <A HREF="http://wirtel.be">http://wirtel.be</A> - @matrixise
</I>&gt;<i> _______________________________________________
</I>&gt;<i> Extend mailing list
</I>&gt;<i> <A HREF="https://lists.ninenines.eu/listinfo/extend">Extend at lists.ninenines.eu</A>
</I>&gt;<i> <A HREF="https://lists.ninenines.eu/listinfo/extend">https://lists.ninenines.eu/listinfo/extend</A>
</I>
-- 
Lo&#239;c Hoguin
<A HREF="http://ninenines.eu">http://ninenines.eu</A>
</PRE>


<!--endarticle-->
    <HR>
    <P><UL>
        <!--threads-->
	<LI>Previous message: <A HREF="000445.html">[99s-extend] cowboy_rest and delete_completed and response
</A></li>
	<LI>Next message: <A HREF="000447.html">[99s-extend] cowboy_rest and delete_completed and response
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#446">[ date ]</a>
              <a href="thread.html#446">[ thread ]</a>
              <a href="subject.html#446">[ subject ]</a>
              <a href="author.html#446">[ author ]</a>
         </LI>
       </UL>

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