def wait_for_doc_update(req): c = SubscribingClient(id='foo-sub') yield c.connect(BACKEND_HOST, FRONTEND_PORT) yield c.bub.foo.subscribe({'junk':'no'}) val = str((yield c.bub.foo.wait())) headers = http.HttpHeaders() headers.add('Content-Length', len(val)) headers.add('Content-Type', 'text/plain') yield http.http_response(req, 200, headers, val)
def finalize_request(self, req, env): code = int(env['diesel.status'].split()[0]) heads = HttpHeaders() for n, v in env['diesel.response_headers']: heads.add(n, v) body = ''.join(env['diesel.output']) if 'Content-Length' not in heads: heads.set('Content-Length', len(body)) return http_response(req, code, heads, body)
def finalize_request(self, req): code = int(self.status.split()[0]) heads = HttpHeaders() for n, v in self.response_headers: heads.add(n, v) body = ''.join(self.outbuf) if 'Content-Length' not in heads: heads.set('Content-Length', len(body)) return http_response(req, code, heads, body)
def hello_http(req): return http.http_response(req, 200, headers, content)
def web_handler(req): heads = HttpHeaders() heads.add('Content-Length', len(content)) heads.add('Content-Type', 'text/html') return http_response(req, 200, heads, content)