fix(abdm): safely decode raw body in recordsFetch if getJSON fails

This commit is contained in:
DevSoftTech Server 2026-09-24 13:13:24 +05:30
parent 092e5cd193
commit 677472e6b0

View File

@ -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']];