Created
April 18, 2011 20:59
-
-
Save jacobian/926162 to your computer and use it in GitHub Desktop.
See if your WSGI server will chunk for you.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Run this under your WSGI server, and then try | |
# | |
# curl -N -i <server> | |
# | |
# If you're chunked, you should see the pause between "hello" and "world". | |
import time | |
def application(environ, start_response): | |
"""Simplest possible application object""" | |
status = '200 OK' | |
response_headers = [('Content-type', 'text/plain')] | |
start_response(status, response_headers) | |
def resp(): | |
yield "hello " | |
time.sleep(1) | |
yield "world!\n" | |
return resp() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment