From 5a30feee730791f2022b33f89ac11425af6b4c64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans=20H=C3=B6rberg?= Date: Wed, 8 May 2013 10:49:57 +0200 Subject: [PATCH] May not add content type if one exists in the header. --- src/saml2/httputil.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/saml2/httputil.py b/src/saml2/httputil.py index cf93f12..ba4baf3 100644 --- a/src/saml2/httputil.py +++ b/src/saml2/httputil.py @@ -39,7 +39,12 @@ class Response(object): self.headers = kwargs.get('headers', []) _content_type = kwargs.get('content', self._content_type) - self.headers.append(('Content-type', _content_type)) + addContentType = True + for header in self.headers: + if 'content-type' == header[0].lower(): + addContentType = False + if addContentType: + self.headers.append(('Content-type', _content_type)) def __call__(self, environ, start_response, **kwargs): start_response(self.status, self.headers)