aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2016-04-18 12:45:01 +0200
committerWladimir J. van der Laan <[email protected]>2016-04-18 12:45:04 +0200
commitb1bf511af693c8ad676c0472633c22aed7b733f2 (patch)
treee0073d36b7a144aefe86ee82f76c5ac307fc2e25
parentMerge #7888: prevector: fix 2 bugs in currently unreached code paths (diff)
parenttests: Check Content-Type header returned from RPC server (diff)
downloaddiscoin-b1bf511af693c8ad676c0472633c22aed7b733f2.tar.xz
discoin-b1bf511af693c8ad676c0472633c22aed7b733f2.zip
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)
-rw-r--r--qa/rpc-tests/test_framework/authproxy.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/qa/rpc-tests/test_framework/authproxy.py b/qa/rpc-tests/test_framework/authproxy.py
index 1eb277259..e5f7ab365 100644
--- a/qa/rpc-tests/test_framework/authproxy.py
+++ b/qa/rpc-tests/test_framework/authproxy.py
@@ -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: