Thanks a lot for the quick reply!<div><br></div><div>I was kind of struggling in my mind about whether to post to twisted-python or twisted-web list and I guess I chose the wrong one because I assumed that the problem was in they way I was using trial. Anyways, thanks again and Twisted is awesome. ;-)</div>
<div><br></div><div>- Teemu<br><br><div class="gmail_quote">On Wed, Apr 9, 2008 at 12:12 AM, Grant Baillie &lt;<a href="mailto:grant@osafoundation.org">grant@osafoundation.org</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
On 8 Apr, 2008, at 04:28, Teemu Harju wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8x;border-left:1px #ccc solid;padding-left:1ex">
...<br>
<br>
</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8x;border-left:1px #ccc solid;padding-left:1ex"><div class="Ih2E3d">
My problem is that I&#39;m experimenting with &quot;trial&quot; to be able to test my code. (I&#39;ve heard that it is a wise thing to do ;-)). What I have is a simple HTTP resource that allows POSTing data. I made this example to illustrate my problem...<br>

<br></div>
...<br>
</blockquote><div class="Ih2E3d">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8x;border-left:1px #ccc solid;padding-left:1ex">
<br>
</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8x;border-left:1px #ccc solid;padding-left:1ex">
 &nbsp; &nbsp;def test_postdata(self):<br>
 &nbsp; &nbsp; &nbsp; &nbsp;d = client.getPage(self.getURL(&quot;test&quot;), method=&quot;POST&quot;,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; postdata=urllib.urlencode({&quot;test&quot;: &quot;data&quot;}))<br>
 &nbsp; &nbsp; &nbsp; &nbsp;d.addCallback(self.failIfEqual, &quot;{}&quot;)<br>
 &nbsp; &nbsp; &nbsp; &nbsp;return d<br>
<br>
</blockquote>
<br></div>
You need to specify a Content-Type in your POST request, e.g.:<div class="Ih2E3d"><br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;d = client.getPage(self.getURL(&quot;test&quot;), method=&quot;POST&quot;,<br></div>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; postdata=urllib.urlencode({&quot;test&quot;: &quot;data&quot;}),<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; headers={&quot;Content-Type&quot;: &quot;application/x-www-form-urlencoded&quot;})<br>
<br>
Otherwise, your POST request is sent as text/html, and the HTTP server code won&#39;t know to parse args out of the request body.<br>
<br>
(Probably this should have gone to twisted-web rather than twisted-python, since in the end it wasn&#39;t really about trial, but http ;).<br>
<br>
--Grant<br>
<br>
<br>
<br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com" target="_blank">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Teemu Harju<br><br>email/jabber: <a href="mailto:teemu.harju@gmail.com">teemu.harju@gmail.com</a><br>blog: <a href="http://www.teemuharju.net">http://www.teemuharju.net</a><br>
<br>~~ &quot;A computer is like air conditioning: it becomes useless when you open windows.&quot; ~~
</div>