Fix message.payload_type

This commit is contained in:
giacomo.tanganelli@for.unipi.it 2018-01-29 14:56:12 +01:00
parent 9f608e46ea
commit 418143f9df

View file

@ -113,10 +113,13 @@ class Serializer(object):
raise AttributeError("Packet length %s, pos %s" % (length_packet, pos))
message.payload = ""
payload = values[pos:]
try:
if message.payload_type == defines.Content_types["application/octet-stream"]:
message.payload = payload
else:
message.payload = payload.decode("utf-8")
except AttributeError:
message.payload = payload.decode("utf-8")
pos += len(payload)
return message