The json.dumps function only accepts native types by default (i.e. list, dict, str, int, etc etc) but it is not prepared to parse user custom types such as UserDict. To parse custom types, it is required to extend the default JsonEncoder class available at the json module. This PR does this, and integrates it into the aiohttp's client session.
This PR also updates the tests to support this use case since the problem was not the dictionary representing the object itself but the context_attributes dictionary inside the object which is an instance of the WhistleBlowerDict class.
closes #176
The
json.dumps
function only accepts native types by default (i.e.list
,dict
,str
,int
, etc etc) but it is not prepared to parse user custom types such asUserDict
. To parse custom types, it is required to extend the defaultJsonEncoder
class available at thejson
module. This PR does this, and integrates it into the aiohttp's client session.This PR also updates the tests to support this use case since the problem was not the dictionary representing the object itself but the
context_attributes
dictionary inside the object which is an instance of theWhistleBlowerDict
class.