Closed rodolfomiranda closed 1 year ago
@rodolfomiranda can you provide an example what should be expected behaviour? I am not sure I get that.
@dkulic
custom-headers
is not a defined field in DIDComm message. I understand that this library, as well as the JVM one, uses that property to embed extra fields that are not listed in the GenericMessage
class. When reading from a json, or generating a json from that class, the customer-headers
must be converted from/to properties in the plain json message.
For example a plain json of the form:
{
"id": "abcd",
"type": "https://didcomm.org/basicmessage/2.0/message",
"from": "did:example:1234",
"to": "did.example:4321",
"body": {'content': 'Hello Bob!'},
"return_route": "yes",
}
should be converted in a GenericMessage object like:
(
"id" = "abcd",
"type" = "https://didcomm.org/basicmessage/2.0/message",
"from" = "did:example:1234",
"to" = "did.example:4321",
"body": {'content': 'Hello Bob!'},
"custom-headers": [{"return_route": "yes"}]
)
and viceversa when going back from a GenericMessage to the plain json object.
In the python library that treatment of custom-headers
seems that was not implemented. However, the JVM library is handling that case correctly. You can see the differences in the following clases:
didcomm-python
didcomm-jvm
Thanks. I will take a look.
@rodolfomiranda I have created a PR for this issue. Can you take a look does it solve your problem?
GenericMessage
class expects custom headers in acustom-headers
field as aList[Header]
from the plain json/dict, instead of a header in the root msg. Example of a custom header Isreturn_route
.