Skip to content

Commit

Permalink
Merge #7833: tests: Check Content-Type header returned from RPC server
Browse files Browse the repository at this point in the history
5078ca4 tests: Check Content-Type header returned from RPC server (Wladimir J. van der Laan)
  • Loading branch information
laanwj committed Apr 18, 2016
2 parents ec870e1 + 5078ca4 commit b1bf511
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions qa/rpc-tests/test_framework/authproxy.py
Expand Up @@ -154,6 +154,11 @@ def _get_response(self):
raise JSONRPCException({
'code': -342, 'message': 'missing HTTP response from server'})

content_type = http_response.getheader('Content-Type')
if content_type != 'application/json':
raise JSONRPCException({
'code': -342, 'message': 'non-JSON HTTP response with \'%i %s\' from server' % (http_response.status, http_response.reason)})

responsedata = http_response.read().decode('utf8')
response = json.loads(responsedata, parse_float=decimal.Decimal)
if "error" in response and response["error"] is None:
Expand Down

0 comments on commit b1bf511

Please sign in to comment.