Skip to content

Commit f56463b

Browse files
committed
fix(appsec): perform _after extractions on the blocking_response 
1 parent 9c93e47 commit f56463b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

datadog_lambda/wrapper.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ def __call__(self, event, context, **kwargs):
177177
return self.response
178178
except BlockingException:
179179
self.blocking_response = get_asm_blocked_response(self.event_source)
180+
return self.blocking_response
180181
except Exception:
181182
from datadog_lambda.metric import submit_errors_metric
182183

@@ -187,8 +188,6 @@ def __call__(self, event, context, **kwargs):
187188
raise
188189
finally:
189190
self._after(event, context)
190-
if self.blocking_response:
191-
return self.blocking_response
192191

193192
def _inject_authorizer_span_headers(self, request_id):
194193
reference_span = self.inferred_span if self.inferred_span else self.span
@@ -283,6 +282,8 @@ def _before(self, event, context):
283282

284283
def _after(self, event, context):
285284
try:
285+
if self.blocking_response:
286+
self.response = self.blocking_response
286287
status_code = extract_http_status_code_tag(self.trigger_tags, self.response)
287288
if status_code:
288289
self.trigger_tags["http.status_code"] = status_code

0 commit comments

Comments
 (0)