greco: decode/encode suds message (#44354)

This commit is contained in:
Frédéric Péters 2020-06-23 11:17:56 +02:00
parent 78e46ed475
commit 8bfc2dfe2d
1 changed files with 2 additions and 2 deletions

View File

@ -118,7 +118,7 @@ class Greco(BaseResource):
xml.add_header('Content-ID', '<rootpart@entrouvert.org>')
# do not base64-encode the soap message
xml.replace_header('Content-Transfer-Encoding', '8bit')
xml_payload = request.message
xml_payload = request.message.decode('utf-8')
# hack payload to include attachment filenames in
# SOAP-ENV:Header.
@ -164,7 +164,7 @@ class Greco(BaseResource):
boundary = message.get_boundary()
request.message = message.as_string(unixfrom=False
).replace(boundary + '\n', boundary + '\r\n'
).replace('\n--' + boundary, '\r\n--' + boundary)
).replace('\n--' + boundary, '\r\n--' + boundary).encode('utf-8')
request.headers.update(dict(message._headers))
request.headers['Authorization'] = self.instance.get_token()
resp = self.instance.requests.post(request.url, data=request.message,