blob: 766b45aeb1dd2cda624f27edba415851e4dd1a45 (
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=%3C1E843973-E0BD-41FA-AC69-53BEECAD5489%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="000444.html">
<LINK REL="Next" HREF="000446.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[99s-extend] cowboy_rest and delete_completed and response</H1>
<B>Stéphane Wirtel</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=%3C1E843973-E0BD-41FA-AC69-53BEECAD5489%40wirtel.be%3E"
TITLE="[99s-extend] cowboy_rest and delete_completed and response">stephane at wirtel.be
</A><BR>
<I>Tue Aug 26 23:59:50 CEST 2014</I>
<P><UL>
<LI>Previous message: <A HREF="000444.html">[99s-extend] Full example of cowboy_rest?
</A></li>
<LI>Next message: <A HREF="000446.html">[99s-extend] cowboy_rest and delete_completed and response
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#445">[ date ]</a>
<a href="thread.html#445">[ thread ]</a>
<a href="subject.html#445">[ subject ]</a>
<a href="author.html#445">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Hi all,
I work with two content-types (json, msgpack).
In the DELETE verb, I need to return an object and in this case, I work
on delete_resource/2 and delete_completed/2.
The problem is, how can I return a body in function of the content-type?
because after delete_completed, there is a call to the
cowboy_rest:has_resp_body function and I need to set the body of the
response.
delete_completed(Req, State) ->
Body = Json or MsgPack ? <-- Which content ?
Req2 = cowboy_req:set_resp_body(Body, Req),
{true, Req2, State}.
Ok, but in this case, what's the reason of content_types_provided/2 and
content_types_accepted/2 ?
Thank you,
Stephane
--
Stéphane Wirtel - <A HREF="http://wirtel.be">http://wirtel.be</A> - @matrixise
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="000444.html">[99s-extend] Full example of cowboy_rest?
</A></li>
<LI>Next message: <A HREF="000446.html">[99s-extend] cowboy_rest and delete_completed and response
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#445">[ date ]</a>
<a href="thread.html#445">[ thread ]</a>
<a href="subject.html#445">[ subject ]</a>
<a href="author.html#445">[ author ]</a>
</LI>
</UL>
<hr>
<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend
mailing list</a><br>
</body></html>
|