diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/utils.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/main/utils.py b/main/utils.py index cdd4ff71..8394e5cd 100644 --- a/main/utils.py +++ b/main/utils.py @@ -8,6 +8,7 @@ import hashlib from django.core.cache import cache from django.db import connections, router +from django.http import HttpResponse from django.utils.timezone import now from django.template.defaultfilters import slugify @@ -55,6 +56,14 @@ def clear_cache_function(func, args, kwargs): cache.delete(key) +def empty_response(): + empty = HttpResponse('') + # designating response as 'streaming' forces ConditionalGetMiddleware to + # not add a 'Content-Length: 0' header + empty.streaming = True + return empty + + def format_http_headers(request): headers = sorted((k, v) for k, v in request.META.items() if k.startswith('HTTP_')) |