mirror of
https://github.com/sprockets/sprockets.mixins.avro-publisher.git
synced 2024-11-25 11:19:51 +00:00
Decode JSON on our own since S3 doesnt set a return content type
This commit is contained in:
parent
7194a2143f
commit
adc69339d2
3 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
1
tests.py
1
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):
|
||||
|
|
Loading…
Reference in a new issue