summaryrefslogtreecommitdiffstats
path: root/archives/extend/2013-October/000284.html
blob: 89cdd6687e5dbd78be8eee9d02aa9416da205b02 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
 <HEAD>
   <TITLE> [99s-extend] cowboy_rest, POST and redirect
   </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%2C%20POST%20and%20redirect&In-Reply-To=%3CCE9537D4.769B%25rolph.deruiter%40spilgames.com%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="000283.html">
   <LINK REL="Next"  HREF="000285.html">
 </HEAD>
 <BODY BGCOLOR="#ffffff">
   <H1>[99s-extend] cowboy_rest, POST and redirect</H1>
    <B>Rolph de Ruiter</B> 
    <A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20cowboy_rest%2C%20POST%20and%20redirect&In-Reply-To=%3CCE9537D4.769B%25rolph.deruiter%40spilgames.com%3E"
       TITLE="[99s-extend] cowboy_rest, POST and redirect">Rolph.deRuiter at spilgames.com
       </A><BR>
    <I>Tue Oct 29 10:00:53 CET 2013</I>
    <P><UL>
        <LI>Previous message: <A HREF="000283.html">[99s-extend] Generate url in cowboy
</A></li>
        <LI>Next message: <A HREF="000285.html">[99s-extend] cowboy_rest, POST and redirect
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#284">[ date ]</a>
              <a href="thread.html#284">[ thread ]</a>
              <a href="subject.html#284">[ subject ]</a>
              <a href="author.html#284">[ author ]</a>
         </LI>
       </UL>
    <HR>  
<!--beginarticle-->
<PRE>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 &lt;0.509.0&gt; on node '<A HREF="https://lists.ninenines.eu/listinfo/extend">api at dev.loc</A>' with exit value: {function_clause,[{cowboy_req,reply,[204,[],&lt;&lt;0 bytes&gt;&gt;,{http_req,#Port&lt;0.14491&gt;,ranch_tcp,keepalive,&lt;0.509.0&gt;,&lt;&lt;4 bytes&gt;&gt;,'HTTP/1.1',{{10,10,10,1},62197},&lt;&lt;15 bytes&gt;&gt;,undefined,8000,&lt;&lt;26 bytes&gt;&gt;,undefined,&lt;&lt;14 bytes&gt;&gt;,[{&lt;&lt;8 bytes&gt;&gt;,&lt;&lt;5 bytes&gt;&gt;}],[{method,&lt;&lt;5 bytes&gt;&gt;}],[{&lt;&lt;4 bytes&gt;&gt;,&lt;&lt;20 bytes&gt;&gt;},{&lt;&lt;10 bytes&gt;&gt;,&lt;&lt;10 bytes&gt;&gt;},{&lt;&lt;14 bytes&gt;&gt;,&lt;&lt;2 bytes&gt;&gt;},{&lt;&lt;6 bytes&gt;&gt;,&lt;&lt;74 bytes&gt;&gt;},{&lt;&lt;6 bytes&gt;&gt;,&lt;&lt;27 bytes&gt;&gt;},{&lt;&lt;10 bytes&gt;&gt;,&lt;&lt;120 bytes&gt;&gt;},{&lt;&lt;12 bytes&gt;&gt;,&lt;&lt;33 bytes&gt;&gt;},{&lt;&lt;7 bytes&gt;&gt;,&lt;&lt;54 bytes&gt;&gt;},{&lt;&lt;15 bytes&gt;&gt;,&lt;&lt;17 bytes&gt;&gt;},{&lt;&lt;15 bytes&gt;&gt;,&lt;&lt;14 bytes&gt;&gt;},{&lt;&lt;6 bytes&gt;&gt;,&lt;&lt;245 bytes&gt;&gt;}],[{&lt;&lt;14 bytes&gt;&gt;,34},{&lt;&lt;6 bytes&gt;&gt;,undefined},{&lt;&lt;14 bytes&gt;&gt;,34},{&lt;&lt;12 bytes&gt;&gt;,{&lt;&lt;11 bytes&gt;&gt;,&lt;&lt;21 bytes&gt;&gt;,[]}},{&lt;&lt;17 bytes&gt;&gt;,undefined},{&lt;&lt;13 bytes&gt;&gt;,...

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?

Cheers,
Rolph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: &lt;<A HREF="http://lists.ninenines.eu/archives/extend/attachments/20131029/5fc5da75/attachment.html">http://lists.ninenines.eu/archives/extend/attachments/20131029/5fc5da75/attachment.html</A>&gt;
</PRE>

<!--endarticle-->
    <HR>
    <P><UL>
        <!--threads-->
	<LI>Previous message: <A HREF="000283.html">[99s-extend] Generate url in cowboy
</A></li>
	<LI>Next message: <A HREF="000285.html">[99s-extend] cowboy_rest, POST and redirect
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#284">[ date ]</a>
              <a href="thread.html#284">[ thread ]</a>
              <a href="subject.html#284">[ subject ]</a>
              <a href="author.html#284">[ author ]</a>
         </LI>
       </UL>

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