Changes between Initial Version and Version 1 of Ticket #17474
- Timestamp:
- Dec 29, 2011, 4:57:04 AM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #17474 – Description
initial v1 1 1 I don't know exactly why, but some ajax requests don't have Content-Type header. 2 When this happens, when I try to get request.POST, I got the following exception: 'NoneType' object has no attribute 'startswith',3 raised by method _load_post_and_files (line 270) of django/http/__init__.py.2 When this happens, when I try to get `request.POST`, I got the following exception: `'NoneType' object has no attribute 'startswith'`, 3 raised by method `_load_post_and_files` at line 270 of `django/http/__init__.py`. 4 4 5 The problem is that when the request doesn't have Content-Type, self.META.get('CONTENT_TYPE', '') returns None.5 The problem is that when the request doesn't have Content-Type, `self.META.get('CONTENT_TYPE', '')` returns `None`. 6 6 To fix the problem I just did it: 7 <code> 7 {{{ 8 8 content_type = self.META.get('CONTENT_TYPE', None) or '' 9 9 if content_type.startswith('multipart'): 10 </code> 10 }}}