Hello,
I have the following code that I initially wrote just using the
BaseHTTPServer module:
def do_POST(self):
"""Respond to a POST request."""
body = "Message was Received!!"
self.send_response(200, "OK")
self.send_header("Content-type", "text/plain")
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(body)
self.data = self.file.readline()
I am trying to replicate the same functionality in Web.py but I seem to be
having issues returning the successful response in the correct format. Here
is what I have so far:
*def** POST*(self):
body = *"Message was Received!!"*
web.ctx.status = *"200 OK"*
web.header(*'Content-Type'*, *'text/plain'*)
web.header(*'Content-Length'*, str(len(body)))
web.ctx.output(body)
data = web.data()
*return* body
Any advice would be much appreciated! Thanks,
-Ben
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/d/optout.