chore: support to add additonal headers in sql logic tests
+import datetime
import json
+import os
+import environs
import requests
+from ecdsa import SigningKey
from mysql.connector.errors import Error
from log import log
-
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
@@ -91,6 +94,8 @@ class HttpConnector():
self._database = database
self._session_max_idle_time = 300
self._session = None
+ e = environs.Env()
+ self._additonal_headers = e.dict("ADDITIONAL_HEADERS")
def query(self, statement, session=None ):
url = "http://{}:{}/v1/query/".format(self._host, self._port)
@@ -112,12 +117,11 @@ class HttpConnector():
}
if session is not None:
query_sql['session'] = session
-
response = requests.post(
url,
data=json.dumps(query_sql),
auth=(self._user,""),
- headers=headers
+ headers={**headers, **self._additonal_headers}
)
try:
return json.loads(response.content)
