really retrieve XML encoding (#10196)

This commit is contained in:
Benjamin Dauvergne 2019-06-17 18:13:09 +02:00
parent 81ab8f4c9e
commit 968aa07faf
2 changed files with 10 additions and 3 deletions

View File

@ -255,11 +255,18 @@ def login(request, user):
def get_xml_encoding(content):
xml_encoding = 'utf-8'
def xmlDeclHandler(version, encoding, standalone):
xml_encoding = encoding
global xml_encoding
if encoding:
xml_encoding = encoding
parser = expat.ParserCreate()
parser.XmlDeclHandler = xmlDeclHandler
parser.Parse(content, True)
try:
parser.Parse(content, True)
except expat.ExpatError as e:
raise ValueError('invalid XML %s' % e)
return xml_encoding

View File

@ -115,7 +115,7 @@ class MockIdp(object):
del self.artifact_message
login.buildResponseMsg()
assert 'rsa-sha256' in login.msgBody
return login.msgBody
return '<?xml version="1.0"?>\n' + login.msgBody
def mock_artifact_resolver(self):
@all_requests