but i get:
Traceback (most recent call last):
File
"/usr/local/lib/python2.6/dist-packages/tornado/simple_httpclient.py",
line 259, in cleanup
yield
File
"/usr/local/lib/python2.6/dist-packages/tornado/stack_context.py", line
183, in wrapped
callback(*args, **kwargs)
File
"/usr/local/lib/python2.6/dist-packages/tornado/simple_httpclient.py",
line 236, in _on_connect
assert self.request.body is None
AssertionError
i have tried using latest stable and git-head.
So, what is wrong or should i look at something else?
cheers
--
Johan Andersson
--
Website: http://lepture.com
Twitter: @lepture
On Saturday, July 2, 2011, Ben Darnell <b...@bendarnell.com> wrote:
> While GET with a body is not generally useful, it's not a
nonsensical combination and it's not prohibited by the HTTP spec (also
see the "multipart/form-data in a GET" thread where we're
debating whether it should be allowed). More importantly, there are
semantic differences between GET and POST - GETs cannot have side
effects (in a properly-written server). I don't think it's a good
idea to silently convert a method that can't have side effects into
one that can just because the user requested a combination of options
that suggest that's what they probably meant; the choice of HTTP
method should be made explicitly.
>
>
> -Ben
>
> On Fri, Jul 1, 2011 at 4:24 AM, Hsiaoming Young
<sophe...@gmail.com> wrote:
>
>
> Ben, why not just add method="POST" when body is not None.
>
> On Tue, Jun 21, 2011 at 00:01, Ben Darnell
<b...@bendarnell.com> wrote:
>> You need to add method="POST" to the fetch call.
>> -Ben
>>
>> On Mon, Jun 20, 2011 at 2:23 AM, Johan Andersson
<j...@i19.se> wrote:
>>>
>>> Hey.
>>> Im trying to post json using this code:
>>> post_args = str({"data": {"testar":
"hejsan", "kind": "cola",
"soft":
>>> 13.0}})
>>> http = tornado.httpclient.AsyncHTTPClient()
>>>
>>> http.fetch('https://api.domain.tld/oauth/v2/stuff',headers={"Content-Type":
>>> "application/json"},body=post_args,callback=self.on_response)
>>>
>>> but i get:
>>> Traceback (most recent call last):
>>> File
>>> "/usr/local/lib/python2.6/dist-packages/tornado/simple_httpclient.py",
line
>>> 259, in cleanup
>>> yield
>>> File
"/usr/local/lib/python2.6/dist-packages/tornado/stack_context.py",
>>> line 183, in wrapped
>>> callback(*args, **kwargs)
>>> File
>>> "/usr/local/lib/python2.6/dist-packages/tornado/simple_httpclient.py",
line
>>> 236, in _on_connect
>>> assert self.request.body is None
>>> AssertionError
>>>
>>> i have tried using latest stable and git-head.
>>> So, what is wrong or should i look at something else?
>>>
>>> cheers
>>>
>>> --
>>> Johan Andersson
>>
>>
>
>
>
> --
> Website: http://lepture.com
> Twitter: @lepture
>
>
>