Ticket #11159: test-client-content-type.1.1.diff
File test-client-content-type.1.1.diff, 682 bytes (added by , 15 years ago) |
---|
-
django/test/client.py
3 3 import sys 4 4 import os 5 5 import re 6 import mimetypes 6 7 try: 7 8 from cStringIO import StringIO 8 9 except ImportError: … … 137 138 '--' + boundary, 138 139 'Content-Disposition: form-data; name="%s"; filename="%s"' \ 139 140 % (to_str(key), to_str(os.path.basename(file.name))), 140 'Content-Type: application/octet-stream',141 'Content-Type: %s' % mimetypes.guess_type(file.name)[0] or 'application/octet-stream', 141 142 '', 142 143 file.read() 143 144 ]