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)