summaryrefslogtreecommitdiffhomepage
path: root/test/python/input_iter/wsgi.py
blob: 04a6a06c1b0a5b21615d4dd1902f1d2c4e86e6fa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
def application(environ, start_response):
    body = []
    content_length = 0

    for l in environ['wsgi.input'].__iter__():
        body.append(l)
        content_length += len(l)

    start_response(
        '200',
        [
            ('Content-Length', str(content_length)),
            ('X-Lines-Count', str(len(body))),
        ],
    )
    return body