From c807880f7ac73f813b2660ea81a00f7712a4e793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 29 Aug 2016 12:39:49 +0200 Subject: Add old mailing list archives --- .../archives/extend/2013-October/000286.html | 117 +++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 _build/static/archives/extend/2013-October/000286.html (limited to '_build/static/archives/extend/2013-October/000286.html') diff --git a/_build/static/archives/extend/2013-October/000286.html b/_build/static/archives/extend/2013-October/000286.html new file mode 100644 index 00000000..bc94b505 --- /dev/null +++ b/_build/static/archives/extend/2013-October/000286.html @@ -0,0 +1,117 @@ + + + + [99s-extend] cowboy_rest, POST and redirect + + + + + + + + + + +

[99s-extend] cowboy_rest, POST and redirect

+ Rolph de Ruiter + Rolph.deRuiter at spilgames.com +
+ Tue Oct 29 10:16:15 CET 2013 +

+
+ +
(forgot to include the list)
+
+On 10/29/13 10:14 AM, "Rolph de Ruiter" <Rolph.deRuiter at spilgames.com>
+wrote:
+
+>Thanks!
+>
+>{halt, NewReq, State} worked like a charm :)
+>
+>Cheers,
+>Rolph
+>
+>On 10/29/13 10:09 AM, "Loïc Hoguin" <essen at ninenines.eu> wrote:
+>
+>>On 10/29/2013 10:00 AM, Rolph de Ruiter wrote:
+>>> Hi,
+>>>
+>>> I'm using cowboy_rest for a part of our api to handle POST requests.
+>>> Under certain conditions, I would like to redirect to a new location
+>>> (based on availability of the redirect qs parameter).
+>>> I was unable to get the moved_temporarily/2 callback to work (was not
+>>> invoked at al). So I just do the 302 myself, using cowboy_req:reply/4.
+>>> This works, however, every time it produces an error in the emulator
+>>> process:
+>>>   [error] emulator Error in process <0.509.0> on node 'api at dev.loc'
+>>>with
+>>> exit value: {function_clause,[{cowboy_req,reply,[204,[],<<0
+>>> bytes>>,{http_req,#Port<0.14491>,ranch_tcp,keepalive,<0.509.0>,<<4
+>>> bytes>>,'HTTP/1.1',{{10,10,10,1},62197},<<15
+>>>bytes>>,undefined,8000,<<26
+>>> bytes>>,undefined,<<14 bytes>>,[{<<8 bytes>>,<<5 bytes>>}],[{method,<<5
+>>> bytes>>}],[{<<4 bytes>>,<<20 bytes>>},{<<10 bytes>>,<<10 bytes>>},{<<14
+>>> bytes>>,<<2 bytes>>},{<<6 bytes>>,<<74 bytes>>},{<<6 bytes>>,<<27
+>>> bytes>>},{<<10 bytes>>,<<120 bytes>>},{<<12 bytes>>,<<33 bytes>>},{<<7
+>>> bytes>>,<<54 bytes>>},{<<15 bytes>>,<<17 bytes>>},{<<15 bytes>>,<<14
+>>> bytes>>},{<<6 bytes>>,<<245 bytes>>}],[{<<14 bytes>>,34},{<<6
+>>> bytes>>,undefined},{<<14 bytes>>,34},{<<12 bytes>>,{<<11 bytes>>,<<21
+>>> bytes>>,[]}},{<<17 bytes>>,undefined},{<<13 bytes>>,...
+>>>
+>>> Can you point me out how to (ideally) make use of moved_temporarily/2
+>>>or
+>>> how I can prevent cowboy_rest from wanting to reply with 204 in this
+>>>case?
+>>
+>>moved_temporarily is only called if the resource previously existed.
+>>
+>>As for calling reply yourself, you just need to return {halt, NewReq,
+>>State} afterwards.
+>>
+>>-- 
+>>Loïc Hoguin
+>>Erlang Cowboy
+>>Nine Nines
+>>http://ninenines.eu
+>
+
+
+
+ + +
+

+ +
+More information about the Extend +mailing list
+ -- cgit v1.2.3