Example #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)
Example #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)
Example #3
0
File: wsgi.py Project: 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)
Example #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)
Example #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)
Example #6
0
File: http.py Project: dowski/aspen
def hello_http(req):
    return http.http_response(req, 200, headers, content)
Example #7
0
File: ws.py Project: 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)
Example #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)
Example #9
0
File: http.py Project: wmoss/diesel
def hello_http(req):
    return http.http_response(req, 200, headers, content)