Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions modules/redcap/php/endpoints/notifications.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ class Notifications extends Endpoint
$data = json_decode((string) $request->getBody(), true);
}

// Handle empty data gracefully (e.g., REDCap DET "Test" button sends
// empty data).
Comment on lines +111 to +112
Copy link
Contributor

@MaximeBICMTL MaximeBICMTL Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Handle empty data gracefully (e.g., REDCap DET "Test" button sends
// empty data).
// Return an empty response when receiving empty data, which is notably
// sent by the test button of the REDCap data entry trigger.

Nit (optional): I personally do not like to use subjective wording (like "gracefully") or acronyms in code comments. But that may be a matter of personal taste, the PR is good.

if ($data === null || $data === []) {
return new \LORIS\Http\Response();
}

try {
$received_datetime = new \DateTimeImmutable();

Expand Down
Loading