From adc69339d2de0d2ef206ee6df03895ad052e07c9 Mon Sep 17 00:00:00 2001 From: "Gavin M. Roy" Date: Wed, 3 May 2017 23:02:08 -0400 Subject: [PATCH] Decode JSON on our own since S3 doesnt set a return content type --- setup.cfg | 2 -- sprockets/mixins/avro_publisher/__init__.py | 3 ++- tests.py | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 7f8e60f..da3855b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,8 +7,6 @@ cover-erase = 1 cover-package = sprockets.mixins.avro_publisher with-coverage = 1 verbosity = 2 -cover-html = 1 -cover-html-dir = build/coverage [upload_docs] upload-dir = build/sphinx/html diff --git a/sprockets/mixins/avro_publisher/__init__.py b/sprockets/mixins/avro_publisher/__init__.py index ec119d6..8fdbedb 100644 --- a/sprockets/mixins/avro_publisher/__init__.py +++ b/sprockets/mixins/avro_publisher/__init__.py @@ -11,6 +11,7 @@ Take note also of the required configurations in sprockets.mixins.amqp """ import io +import json import logging from sprockets.mixins import amqp, http @@ -123,7 +124,7 @@ class PublishingMixin(amqp.PublishingMixin, http.HTTPClientMixin): """ response = yield self.http_fetch(self._schema_url(message_type)) if response.ok: - raise gen.Return(response.body) + raise gen.Return(json.loads(response.raw.body.decode('utf-8'))) raise SchemaFetchError() def _schema_url(self, message_type): diff --git a/tests.py b/tests.py index cafd9e6..7f65546 100644 --- a/tests.py +++ b/tests.py @@ -62,6 +62,7 @@ class Test1RequestHandler(avro_publisher.PublishingMixin, web.RequestHandler): 'message_id': str(uuid.uuid4()), 'type': MESSAGE_TYPE}} + class Test2RequestHandler(Test1RequestHandler): def initialize(self):