Skip to content

Commit 063f54f

Browse files
committed
Enhance handler function documentation and update coverage exclusions for preview environment
1 parent 5bacdcb commit 063f54f

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

infrastructure/environments/preview/handler.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,23 @@
66
logger.setLevel(logging.INFO)
77

88

9-
def handler(event: dict[str, Any], context):
9+
def handler(event: dict[str, Any], context: Any):
10+
"""Handler for the preview environment. This simply returns a 200 response with
11+
the request headers, which can be used to verify and debug how the environment
12+
is working and to inspect the incoming request.
13+
14+
Args:
15+
event (dict[str, Any]): The event dictionary containing request data from API Gateway.
16+
context (Any): AWS lambda context object (what the lambda is running in)
17+
18+
Returns:
19+
dict: Diagnostic 200 response with request headers.
20+
"""
1021
logger.info("Lambda context: %s", context)
1122
headers = event.get("headers", {}) or {}
1223

1324
# Log headers to CloudWatch
14-
logger.info("Incoming request headers:") # pragma: no cover
25+
logger.info("Incoming request headers:")
1526
for k, v in headers.items():
1627
logger.info("%s: %s", k, v)
1728

sonar-project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ sonar.exclusions=docs/**,pathology-api/test-artefacts/**,pathology-api/coverage-
1313
sonar.tests=pathology-api
1414
sonar.test.inclusions=pathology-api/**/test_*.py, pathology-api/tests/**
1515

16-
sonar.coverage.exclusions=**/tests/**,**/features/**,**/test_*.py,infrastructure/images/api-gateway-mock/resources/**
16+
sonar.coverage.exclusions=**/tests/**,**/features/**,**/test_*.py,infrastructure/images/api-gateway-mock/resources/**,**/infrastructure/environments/preview/**
1717
# Set Python version for more precise analysis
1818
sonar.python.version=3.14

0 commit comments

Comments
 (0)