Adding a third return value from connection.perform_request - headers
This will be used to implement deserializing based on mimetype
This commit is contained in:
@@ -58,4 +58,4 @@ class RequestsHttpConnection(Connection):
|
||||
|
||||
self.log_request_success(method, url, response.request.path_url, body, response.status_code, raw_data, duration)
|
||||
|
||||
return response.status_code, raw_data
|
||||
return response.status_code, response.headers, raw_data
|
||||
|
||||
@@ -57,7 +57,5 @@ class Urllib3HttpConnection(Connection):
|
||||
self.log_request_success(method, full_url, url, body, response.status,
|
||||
raw_data, duration)
|
||||
|
||||
return response.status, raw_data
|
||||
|
||||
|
||||
return response.status, response.getheaders(), raw_data
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ class MemcachedConnection(PoolingConnection):
|
||||
self.log_request_success(method, full_url, url, body, status,
|
||||
response, duration)
|
||||
|
||||
return status, response
|
||||
return status, {}, response
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -73,7 +73,5 @@ class ThriftConnection(PoolingConnection):
|
||||
self.log_request_success(method, url, url, body, response.status,
|
||||
response.body, duration)
|
||||
|
||||
return response.status, response.body
|
||||
|
||||
|
||||
return response.status, response.headers or {}, response.body
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ class Transport(object):
|
||||
for c in self.connection_pool.connections + self.seed_connections:
|
||||
try:
|
||||
# use small timeout for the sniffing request, should be a fast api call
|
||||
_, node_info = c.perform_request('GET', '/_cluster/nodes', timeout=.1)
|
||||
_, headers, node_info = c.perform_request('GET', '/_cluster/nodes', timeout=.1)
|
||||
node_info = self.serializer.loads(node_info)
|
||||
break
|
||||
except (ConnectionError, SerializationError):
|
||||
@@ -251,7 +251,7 @@ class Transport(object):
|
||||
connection = self.get_connection()
|
||||
|
||||
try:
|
||||
status, raw_data = connection.perform_request(method, url, params, body, ignore=ignore)
|
||||
status, headers, raw_data = connection.perform_request(method, url, params, body, ignore=ignore)
|
||||
except ConnectionError:
|
||||
self.mark_dead(connection)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user