From efb4763af4523465e7ffed40b2be9037263e5106 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Mon, 28 Oct 2024 13:30:57 +0530 Subject: [PATCH] add a type check in is_privacy_enabled validation --- care/facility/api/viewsets/bed.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/care/facility/api/viewsets/bed.py b/care/facility/api/viewsets/bed.py index 2c714ad1ea..31220662fb 100644 --- a/care/facility/api/viewsets/bed.py +++ b/care/facility/api/viewsets/bed.py @@ -238,9 +238,9 @@ def set_privacy(self, request, external_id): is_privacy_enabled = request.data.get("is_privacy_enabled") - if is_privacy_enabled is None: + if is_privacy_enabled is None and not isinstance(is_privacy_enabled, bool): return Response( - {"detail": "'is_privacy_enabled' field is required."}, + {"detail": "is_privacy_enabled is required and should be a boolean"}, status=status.HTTP_400_BAD_REQUEST, )