Browse Source

Merge #7833: tests: Check Content-Type header returned from RPC server

5078ca4 tests: Check Content-Type header returned from RPC server (Wladimir J. van der Laan)
0.13
Wladimir J. van der Laan 9 years ago
parent
commit
b1bf511af6
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 5
      qa/rpc-tests/test_framework/authproxy.py

5
qa/rpc-tests/test_framework/authproxy.py

@ -154,6 +154,11 @@ class AuthServiceProxy(object): @@ -154,6 +154,11 @@ class AuthServiceProxy(object):
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:

Loading…
Cancel
Save