Skip to content

Commit 8d6a010

Browse files
committed
Fix handling of empty mapping rules response
1 parent 0c7981d commit 8d6a010

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

horizon/enforcer/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,8 @@ async def is_allowed_url(
311311
data = await post_to_opa(request, "mapping_rules", None)
312312

313313
mapping_rules = []
314-
data_result = json.loads(data.body).get("result")
315-
mapping_rules_json = data_result.get("all", []) if data_result is not None else []
314+
data_result = json.loads(data.body).get("result") or {}
315+
mapping_rules_json = data_result.get("all") or []
316316

317317
for mapping_rule in mapping_rules_json:
318318
mapping_rules.append(parse_obj_as(MappingRuleData, mapping_rule))

0 commit comments

Comments
 (0)