Comment 0 for bug 1295258

Revision history for this message
Nathan Buckner (nathan-buckner) wrote :

When instansiating the AutoMarshalling client it uses the serialize_format to set the Content-Type but ignores the deserialize_format in terms of the Accept header requiring users to set it __init__ is called or serialization will fail.(unless the api defaults to the type the user sent in deserialize_format.

class AutoMarshallingHTTPClient(HTTPClient):
    """@TODO: Turn serialization and deserialization into decorators so
    that we can support serialization and deserialization on a per-method
    basis"""
    def __init__(self, serialize_format=None, deserialize_format=None):
        super(AutoMarshallingHTTPClient, self).__init__()
        self.serialize_format = serialize_format
        self.deserialize_format = deserialize_format or self.serialize_format
        self.default_headers = {'Content-Type': 'application/{format}'.format(
            format=serialize_format)}