| 23 | |
| 24 | |
| 25 | def application(environ, start_response): |
| 26 | req = Request(environ) |
| 27 | resp = Response() |
| 28 | env_input = environ['wsgi.input'] |
| 29 | len_body = len(req.body) |
| 30 | env_input.input.seek(0) |
| 31 | if req.path_info == '/read': |
| 32 | resp.body = env_input.read(len_body) |
| 33 | elif req.path_info == '/read_line': |
| 34 | resp.body = env_input.readline(len_body) |
| 35 | elif req.path_info == '/read_lines': |
| 36 | resp.body = b'-'.join(env_input.readlines(len_body)) |
| 37 | elif req.path_info == '/close': |
| 38 | resp.body = env_input.close() |
| 39 | return resp(environ, start_response) |
| 40 | |
| 41 | |
| 42 | class TestLatin1Assertion(unittest.TestCase): |