Ticket #11159: test-client-content-type.1.1.diff

File test-client-content-type.1.1.diff, 682 bytes (added by notanumber, 15 years ago)

Patch for Django 1.1

  • django/test/client.py

     
    33import sys
    44import os
    55import re
     6import mimetypes
    67try:
    78    from cStringIO import StringIO
    89except ImportError:
     
    137138        '--' + boundary,
    138139        'Content-Disposition: form-data; name="%s"; filename="%s"' \
    139140            % (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',
    141142        '',
    142143        file.read()
    143144    ]
Back to Top