Decode JSON on our own since S3 doesnt set a return content type

This commit is contained in:
Gavin M. Roy 2017-05-03 23:02:08 -04:00
parent 7194a2143f
commit adc69339d2
3 changed files with 3 additions and 3 deletions

View file

@ -7,8 +7,6 @@ cover-erase = 1
cover-package = sprockets.mixins.avro_publisher cover-package = sprockets.mixins.avro_publisher
with-coverage = 1 with-coverage = 1
verbosity = 2 verbosity = 2
cover-html = 1
cover-html-dir = build/coverage
[upload_docs] [upload_docs]
upload-dir = build/sphinx/html upload-dir = build/sphinx/html

View file

@ -11,6 +11,7 @@ Take note also of the required configurations in sprockets.mixins.amqp
""" """
import io import io
import json
import logging import logging
from sprockets.mixins import amqp, http 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)) response = yield self.http_fetch(self._schema_url(message_type))
if response.ok: if response.ok:
raise gen.Return(response.body) raise gen.Return(json.loads(response.raw.body.decode('utf-8')))
raise SchemaFetchError() raise SchemaFetchError()
def _schema_url(self, message_type): def _schema_url(self, message_type):

View file

@ -62,6 +62,7 @@ class Test1RequestHandler(avro_publisher.PublishingMixin, web.RequestHandler):
'message_id': str(uuid.uuid4()), 'message_id': str(uuid.uuid4()),
'type': MESSAGE_TYPE}} 'type': MESSAGE_TYPE}}
class Test2RequestHandler(Test1RequestHandler): class Test2RequestHandler(Test1RequestHandler):
def initialize(self): def initialize(self):