Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
Arquivo: wsgi.py Projeto: dowski/aspen
 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)
Exemplo n.º 4
0
    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)
Exemplo n.º 5
0
    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)
Exemplo n.º 6
0
Arquivo: http.py Projeto: dowski/aspen
def hello_http(req):
    return http.http_response(req, 200, headers, content)
Exemplo n.º 7
0
Arquivo: ws.py Projeto: dowski/aspen
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)
Exemplo n.º 8
0
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)
Exemplo n.º 9
0
Arquivo: http.py Projeto: wmoss/diesel
def hello_http(req):
    return http.http_response(req, 200, headers, content)