From 677472e6b08c0961127805215928ddcbe031e843 Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Thu, 24 Sep 2026 13:13:24 +0530 Subject: [PATCH] fix(abdm): safely decode raw body in recordsFetch if getJSON fails --- app/Controllers/AbdmGateway.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Controllers/AbdmGateway.php b/app/Controllers/AbdmGateway.php index c768a5f..2b0daa1 100644 --- a/app/Controllers/AbdmGateway.php +++ b/app/Controllers/AbdmGateway.php @@ -4858,7 +4858,12 @@ class AbdmGateway extends BaseController ]); } - $body = $this->request->getJSON(true) ?: []; + try { + $body = $this->request->getJSON(true) ?: []; + } catch (\Throwable) { + $rawBody = (string) $this->request->getBody(); + $body = json_decode($rawBody, true) ?: []; + } $careContextRefs = $body['careContextReferences'] ?? []; if (empty($careContextRefs) && !empty($body['careContextReference'])) { $careContextRefs = [$body['careContextReference']];