Simplest possible application object
(environ, start_response)
| 20 | |
| 21 | |
| 22 | def app(environ, start_response): |
| 23 | """Simplest possible application object""" |
| 24 | status = '200 OK' |
| 25 | |
| 26 | response_headers = [ |
| 27 | ('Content-type', 'text/plain'), |
| 28 | ('Transfer-Encoding', "chunked"), |
| 29 | ('X-Gunicorn-Version', __version__) |
| 30 | ] |
| 31 | start_response(status, response_headers) |
| 32 | |
| 33 | body = environ['wsgi.input'] |
| 34 | |
| 35 | lines = [] |
| 36 | while True: |
| 37 | line = body.readline() |
| 38 | if line == b"": |
| 39 | break |
| 40 | print(line) |
| 41 | lines.append(line) |
| 42 | |
| 43 | return iter(lines) |