diff options
Diffstat (limited to 'django/http')
| -rw-r--r-- | django/http/response.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/django/http/response.py b/django/http/response.py index 3edf10d1e8..2735e3c59d 100644 --- a/django/http/response.py +++ b/django/http/response.py @@ -261,6 +261,11 @@ class HttpResponseBase(six.Iterator): if httponly: self.cookies[key]['httponly'] = True + def setdefault(self, key, value): + """Sets a header unless it has already been set.""" + if key not in self: + self[key] = value + def set_signed_cookie(self, key, value, salt='', **kwargs): value = signing.get_cookie_signer(salt=key + salt).sign(value) return self.set_cookie(key, value, **kwargs) |
