{"action":"closed","issue":{"url":"https://api.github.com/repos/cobrateam/django-htmlmin/issues/98","repository_url":"https://api.github.com/repos/cobrateam/django-htmlmin","labels_url":"https://api.github.com/repos/cobrateam/django-htmlmin/issues/98/labels{/name}","comments_url":"https://api.github.com/repos/cobrateam/django-htmlmin/issues/98/comments","events_url":"https://api.github.com/repos/cobrateam/django-htmlmin/issues/98/events","html_url":"https://github.com/cobrateam/django-htmlmin/issues/98","id":140405993,"number":98,"title":"Exception raised when no content type set: \"Error in formatting: KeyError: u'content-type'\"","user":{"login":"JoeJasinski","id":417872,"avatar_url":"https://avatars.githubusercontent.com/u/417872?v=3","gravatar_id":"","url":"https://api.github.com/users/JoeJasinski","html_url":"https://github.com/JoeJasinski","followers_url":"https://api.github.com/users/JoeJasinski/followers","following_url":"https://api.github.com/users/JoeJasinski/following{/other_user}","gists_url":"https://api.github.com/users/JoeJasinski/gists{/gist_id}","starred_url":"https://api.github.com/users/JoeJasinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoeJasinski/subscriptions","organizations_url":"https://api.github.com/users/JoeJasinski/orgs","repos_url":"https://api.github.com/users/JoeJasinski/repos","events_url":"https://api.github.com/users/JoeJasinski/events{/privacy}","received_events_url":"https://api.github.com/users/JoeJasinski/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cobrateam/django-htmlmin/labels/Bug","name":"Bug","color":"e10c02"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-12T18:43:26Z","updated_at":"2016-03-21T03:29:39Z","closed_at":"2016-03-21T03:29:39Z","body":"Hi,\r\n\r\nWhen the content-type is not available in the response, the following exception is raised.  I encounter this error when serving up static media with django-filer, but it looks like this could happen in any case where the request['Content-Type'] is not present.\r\n\r\n\r\n`\r\nEnvironment:\r\n\r\nRequest Method: GET\r\nRequest URL: http://localhost:8000/media/filer_public/df/66/df664fc4-d8a6-4d88-8aef-7be5e3aef32a/chipy-05-chicago_flag_python_logo-01.jpg\r\n\r\nDjango Version: 1.9.4\r\nPython Version: 2.7.9\r\nInstalled Applications:\r\n('django.contrib.auth',\r\n 'django.contrib.contenttypes',\r\n 'django.contrib.sessions',\r\n 'django.contrib.sites',\r\n 'django.contrib.messages',\r\n 'django.contrib.staticfiles',\r\n 'django.contrib.sitemaps',\r\n 'djangocms_admin_style',\r\n 'django.contrib.admin',\r\n 'easy_thumbnails',\r\n 'mptt',\r\n 'filer',\r\n 'nocaptcha_recaptcha',\r\n 'cms',\r\n 'treebeard',\r\n 'menus',\r\n 'sekizai',\r\n 'reversion',\r\n 'sorl.thumbnail',\r\n 'django_extensions',\r\n 'pagefeature',\r\n 'contact_form',\r\n 'photo_gallery.apps.PhotoConfig',\r\n 'djangocms_inherit',\r\n 'djangocms_teaser',\r\n 'djangocms_link',\r\n 'djangocms_snippet',\r\n 'djangocms_text_ckeditor',\r\n 'djangocms_plain_text')\r\nInstalled Middleware:\r\n('django.middleware.common.CommonMiddleware',\r\n 'htmlmin.middleware.HtmlMinifyMiddleware',\r\n 'django.contrib.sessions.middleware.SessionMiddleware',\r\n 'django.middleware.csrf.CsrfViewMiddleware',\r\n 'django.middleware.locale.LocaleMiddleware',\r\n 'django.contrib.auth.middleware.AuthenticationMiddleware',\r\n 'django.contrib.messages.middleware.MessageMiddleware',\r\n 'django.middleware.clickjacking.XFrameOptionsMiddleware',\r\n 'cms.middleware.user.CurrentUserMiddleware',\r\n 'cms.middleware.page.CurrentPageMiddleware',\r\n `'cms.middleware.toolbar.ToolbarMiddleware',`\r\n 'cms.middleware.language.LanguageCookieMiddleware',\r\n 'htmlmin.middleware.MarkRequestMiddleware')\r\n\r\n\r\nTraceback:\r\n\r\nFile \"/Users/jjasinski/Sites/joejasinski/envs/joejasinski/lib/python2.7/site-packages/django/core/handlers/base.py\" in get_response\r\n  235.                 response = middleware_method(request, response)\r\n\r\nFile \"/mysite/mysite/envs/mysite/lib/python2.7/site-packages/htmlmin/middleware.py\" in process_response\r\n  41.         if minify and self.can_minify_response(request, response):\r\n\r\nFile \"/mysite/envs/mysite/lib/python2.7/site-packages/htmlmin/middleware.py\" in can_minify_response\r\n  32.         resp_ok = 'text/html' in response['Content-Type']\r\n\r\nFile \"/mysite/envs/mysite/lib/python2.7/site-packages/django/http/response.py\" in __getitem__\r\n  152.         return self._headers[header.lower()][1]\r\n\r\nException Type: KeyError at /media/filer_public/df/66/df664fc4-d8a6-4d88-8aef-7be5e3aef32a/chipy-05-chicago_flag_python_logo-01.jpg\r\nException Value: 'content-type'\r\n`"}}