Skip to content

Commit 8c9fc5e

Browse files
committed
Adding dict type check for mypy.
1 parent 54a487f commit 8c9fc5e

File tree

1 file changed

+8
-1
lines changed
  • stac_fastapi/elasticsearch/stac_fastapi/elasticsearch

1 file changed

+8
-1
lines changed

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/config.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,15 @@ def _es_config() -> Dict[str, Any]:
4040
config["http_auth"] = (u, p)
4141

4242
if api_key := os.getenv("ES_API_KEY"):
43-
config = {**config, **{"headers": {"x-api-key": api_key}}}
43+
if isinstance(config["headers"], dict):
44+
headers = {**config["headers"], "x-api-key": api_key}
4445

46+
else:
47+
headers = {"x-api-key": api_key}
48+
49+
config["headers"] = headers
50+
51+
print(config)
4552
return config
4653

4754

0 commit comments

Comments
 (0)