xref: /unit/test/python/input_iter/wsgi.py (revision 1400:cbd75efbfb74)
1603Szelenkov@nginx.comdef application(environ, start_response):
2*1400Smax.romanov@nginx.com    body = []
3*1400Smax.romanov@nginx.com    content_length = 0
4*1400Smax.romanov@nginx.com
5*1400Smax.romanov@nginx.com    for l in environ['wsgi.input'].__iter__():
6*1400Smax.romanov@nginx.com        body.append(l)
7*1400Smax.romanov@nginx.com        content_length += len(l)
8603Szelenkov@nginx.com
9*1400Smax.romanov@nginx.com    start_response(
10*1400Smax.romanov@nginx.com        '200',
11*1400Smax.romanov@nginx.com        [
12*1400Smax.romanov@nginx.com            ('Content-Length', str(content_length)),
13*1400Smax.romanov@nginx.com            ('X-Lines-Count', str(len(body))),
14*1400Smax.romanov@nginx.com        ],
15*1400Smax.romanov@nginx.com    )
16*1400Smax.romanov@nginx.com    return body
17