Browse Source

pytest: Set correct header in mock bitcoind

json-streaming
Christian Decker 6 years ago
parent
commit
2dabc5af93
  1. 7
      tests/btcproxy.py

7
tests/btcproxy.py

@ -8,6 +8,7 @@ from cheroot.wsgi import Server
from cheroot.wsgi import PathInfoDispatcher from cheroot.wsgi import PathInfoDispatcher
import decimal import decimal
import flask
import json import json
import logging import logging
import os import os
@ -62,9 +63,11 @@ class ProxiedBitcoinD(BitcoinD):
if isinstance(r, list): if isinstance(r, list):
reply = [self._handle_request(subreq) for subreq in r] reply = [self._handle_request(subreq) for subreq in r]
else: else:
reply = self._handle_request(subreq) reply = self._handle_request(r)
return json.dumps(reply, cls=DecimalEncoder) response = flask.Response(json.dumps(reply, cls=DecimalEncoder))
response.headers['Content-Type'] = 'application/json'
return response
def start(self): def start(self):
d = PathInfoDispatcher({'/': self.app}) d = PathInfoDispatcher({'/': self.app})

Loading…
Cancel
Save