I cannot read the body from a POST request in a Google app for every time I send a line containing the colon ":"
This is the request handler class:
class MessageSync(webapp.RequestHandler): def post(self): print self.request.body
An ad is my testing script:
import httplib2 json_works = '{"works"}' json_doesnt_work = '{"sux": "test"}' h = httplib2.Http() resp, content = h.request('http://localhost:8080/msg', 'POST', json_works , headers={'Content-Type': 'application/json'}) print content
If I use the request body of the json_works variable, it will be printed, but if I use json_doest_work, I will not get any response to the console. Unless I print the entire request object, I get the following:
POST /msg Content-Length: 134 Content-Type: application/json Host: localhost:8080 User-Agent: Python-httplib2/$Rev$ {"sux": "test"}
Why hack I canβt get only the body? Thanks!
source share