Exemplo n.º 1
0
    def _loads_v4(self, request, data, body_file=None):
        try:
            cached = msgpack.loads(data, raw=False)
        except ValueError:
            return

        return self.prepare_response(request, cached, body_file)
Exemplo n.º 2
0
    def _loads_v4(self, request, data):
        try:
            cached = msgpack.loads(data, encoding="utf-8")
        except ValueError:
            return

        return self.prepare_response(request, cached)
Exemplo n.º 3
0
        cached["response"]["body"] = _b64_decode_bytes(cached["response"]["body"])
        cached["response"]["headers"] = dict(
            (_b64_decode_str(k), _b64_decode_str(v))
            for k, v in cached["response"]["headers"].items()
        )
        cached["response"]["reason"] = _b64_decode_str(cached["response"]["reason"])
        cached["vary"] = dict(
            (_b64_decode_str(k), _b64_decode_str(v) if v is not None else v)
            for k, v in cached["vary"].items()
        )

        return self.prepare_response(request, cached)

    def _loads_v3(self, request, data):
        # Due to Python 2 encoding issues, it's impossible to know for sure
        # exactly how to load v3 entries, thus we'll treat these as a miss so
        # that they get rewritten out as v4 entries.
        return

    def _loads_v4(self, request, data):
        try:
<<<<<<< HEAD
            cached = msgpack.loads(data, raw=False)
=======
            cached = msgpack.loads(data, encoding="utf-8")
>>>>>>> 71358189c5e72ee2ac9883b408a2f540a7f5745e
        except ValueError:
            return

        return self.prepare_response(request, cached)