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=None, RequestURI=None, ContentLength=0, *args, **kwargs): yield http.ok() if Method == 'POST': @autostart def devNull(): while True: yield yield http.copyBytes(ContentLength, devNull()) wrong = yield 'Path = ' + str(RequestURI) self.assertEquals(None, wrong) # Second request must not end up here done.append(True)
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(self, Method=None, RequestURI=None, HTTPVersion=None, Headers=None, fragment=None, netloc=None, query=None, path=None, scheme=None): yield http.ok() yield http.noheaders() yield 'Echo ' + RequestURI done.append(True)
def handle(self): yield http.ok() yield http.noheaders() yield 'this was the GET handler'
def handle(this, ContentLength): body = yield http.readRe('(?P<BODY>.*)', ContentLength) self.assertEquals('XXYYZZ', body['BODY']) yield http.ok() yield http.noheaders() yield 'this was the post handler'
def processRequest(this, **kwargs): yield http.ok() yield http.noheaders() yield 'Bye'
def processRequest(self, *args, **kwargs): yield http.ok() yield http.headers('Content-Length', 6) yield 'Hello!'
def processRequest(this, Method, RequestURI, HTTPVersion, Headers, *args, **kwargs): yield http.ok() yield http.headers('Content-Length', 3) yield 'Bye'