示例#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)
示例#2
0
文件: wsgi.py 项目: timdoug/diesel
 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)
示例#3
0
文件: wsgi.py 项目: 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)
示例#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)
示例#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)
示例#6
0
文件: http.py 项目: dowski/aspen
def hello_http(req):
    return http.http_response(req, 200, headers, content)
示例#7
0
文件: ws.py 项目: 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)
示例#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)
示例#9
0
文件: http.py 项目: wmoss/diesel
def hello_http(req):
    return http.http_response(req, 200, headers, content)