Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(flutterwave): handle empty 400 bodies on v3 list endpoints (#130336)

Tom Owersd619f26db341
diff --git a/products/warehouse_sources/sources/flutterwave/flutterwave.py b/products/warehouse_sources/sources/flutterwave/flutterwave.py
index 5437ec07c003..78f9fde960eb 100644
--- a/products/warehouse_sources/sources/flutterwave/flutterwave.py
+++ b/products/warehouse_sources/sources/flutterwave/flutterwave.py
@@ -56,9 +56,13 @@ WINDOW_END_PADDING_DAYS = 1
# is deliberately narrow: a genuine parameter error ("page parameter must be a positive integer")
# does not carry this wording and still raises. Both cases are listed because the substring match is
# case sensitive and v3 is inconsistent about capitalizing "found".
+# v3's own reference docs document a third shape for this same "nothing to return" 400: a bare `{}`
+# body with no message at all. A genuine parameter error always carries a message, so an empty body
+# is unambiguous and safe to read the same way.
_NO_RECORDS_RESPONSE_ACTIONS: list[ResponseAction] = [
{"status_code": 400, "content": "found", "action": "ignore"},
{"status_code": 400, "content": "Found", "action": "ignore"},
+ {"status_code": 400, "content": "{}", "action": "ignore"},
]
diff --git a/products/warehouse_sources/sources/flutterwave/tests/test_flutterwave.py b/products/warehouse_sources/sources/flutterwave/tests/test_flutterwave.py
index 54734101a291..e1f89fda2f98 100644
--- a/products/warehouse_sources/sources/flutterwave/tests/test_flutterwave.py
+++ b/products/warehouse_sources/sources/flutterwave/tests/test_flutterwave.py
@@ -245,6 +245,9 @@ class TestNoRecordsResponses:
[
("lowercase", {"status": "error", "message": "No settlements found", "data": None}),
("capitalized", {"status": "error", "message": "Transaction Not Found", "data": None}),
+ # v3's own reference docs give this as the example 400 body for these list endpoints:
+ # no message at all, just an empty object.
+ ("empty_body", {}),
]
)
def test_empty_range_400_reads_as_an_empty_table(self, _name: str, body: dict[str, Any]) -> None: