Output from client.py is text/plain
although no content-type header was sent to the server.
Why?
# ---------------------------------------------- server.py
from wsgiref.simple_server import make_server
def simple_app(environ, start_response):
print environ.get('CONTENT_TYPE')
start_response('200 OK', [])
return []
make_server('localhost', 88, simple_app).serve_forever()
# ---------------------------------------------- client.py
import subprocess
import urllib2
p = subprocess.Popen(['python', '-u', 'server.py'])
req = urllib2.Request('http://localhost:88', headers={})
assert not req.has_header('content-type')
urllib2.urlopen(req).read()
p.terminate()