python - Tornado. How get raw request.body? -


People can not get raw body data with Hurricane I request curl -i localhost: 8888 - Request'body ', but received the ' {{code> '{"a": 12}' and a string '{"a": 12}' A: 12} '. Source code:

  import tornado.web import tornado.ioloop class mainhandler (tornado.web request handler): def post (self): self.write (self.request.body) if __name__ == "__man__": ap = tornado.web.app ({(r "/", manhandler)}) app.liten (3000) ternado Lollop. Iolopinstance (). Start ()  

curl result:

  $ curl 127.0.0.1:3000 -i -d {"a": 12} HTTP / 1.1 200 OK Content-type: text / html; Charset = UTF-8 Server: Tornado Server / 4.0.2 Content-Length: 6 Date: Thursday, 22 January 2015 14:00:19 GMT {a: 12}  

Python Version 3.4 .2, Storm version is 4.0.2

This is an open quote issue: Removing the shell Col. 127.0.0.1:3000 -i -d {"a": 12} Citations in the cursor. If you cite the argument of -d (which you did in your body of question: curl -i localhost: 8888 -d '{"a": 12}' , you should get the expected result.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -