[99s-extend] cowboy_rest and delete_completed and response

Stéphane Wirtel stephane at wirtel.be
Tue Aug 26 23:59:50 CEST 2014


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 - http://wirtel.be - @matrixise


More information about the Extend mailing list