def processRequest(self, Method=None, ContentLength=None, *args, **kwargs): if Method != 'POST': return result = yield http.readRe('(?P<BODY>.*)', ContentLength) body = result['BODY'] yield http.ok() yield http.headers('a', 'b') yield 'Hello ' + body
def processRequest(this, Method, RequestURI, HTTPVersion, Headers, **kwargs): length = int(Headers['content-length'].keys()[0]) @autostart def destination(result): while True: result += (yield) result = [] yield http.copyBytes(length, destination(result)) self.assertEquals('This is a body', ''.join(result)) yield http.ok() yield http.headers('a', 'b') yield 'Hello ' + ''.join(result)
def processRequest(this, Method, RequestURI, HTTPVersion, Headers, *args, **kwargs): yield http.ok() yield http.headers('Content-Length', 3) yield 'Bye'
def processRequest(self, *args, **kwargs): yield http.ok() yield http.headers('Content-Length', 6) yield 'Hello!'