Fix message.payload_type
This commit is contained in:
parent
9f608e46ea
commit
418143f9df
1 changed files with 6 additions and 3 deletions
|
@ -113,10 +113,13 @@ class Serializer(object):
|
||||||
raise AttributeError("Packet length %s, pos %s" % (length_packet, pos))
|
raise AttributeError("Packet length %s, pos %s" % (length_packet, pos))
|
||||||
message.payload = ""
|
message.payload = ""
|
||||||
payload = values[pos:]
|
payload = values[pos:]
|
||||||
|
try:
|
||||||
if message.payload_type == defines.Content_types["application/octet-stream"]:
|
if message.payload_type == defines.Content_types["application/octet-stream"]:
|
||||||
message.payload = payload
|
message.payload = payload
|
||||||
else:
|
else:
|
||||||
message.payload = payload.decode("utf-8")
|
message.payload = payload.decode("utf-8")
|
||||||
|
except AttributeError:
|
||||||
|
message.payload = payload.decode("utf-8")
|
||||||
pos += len(payload)
|
pos += len(payload)
|
||||||
|
|
||||||
return message
|
return message
|
||||||
|
|
Loading…
Reference in a new issue