Pass the consul token as a header
Headers are now the prefered way to pass the token to the consul API
@@ -82,6 +82,8 @@ class HTTPClient(object):
kwargs['timeout'] = (float(params['wait'][:-1]) if 'wait' in params else 300) + 1
else:
kwargs['timeout'] = self._read_timeout
+ if isinstance(params, dict) and 'token' in params and params['token']:
+ kwargs['headers'] = {'X-Consul-Token': params.pop('token')}
return callback(self.response(self.http.request(method.upper(), self.uri(path, params), **kwargs)))
return wrapper
