From fdb006de2c8bf3304c684a1be77959f716714955 Mon Sep 17 00:00:00 2001 From: Ben White Date: Tue, 19 Mar 2024 16:17:50 +0100 Subject: [PATCH] Fix return data for 204 status --- posthog/api/authentication.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/posthog/api/authentication.py b/posthog/api/authentication.py index 9b7dc954a97fa..10538c1d77ceb 100644 --- a/posthog/api/authentication.py +++ b/posthog/api/authentication.py @@ -179,6 +179,10 @@ def create(self, request: Request, *args: Any, **kwargs: Any) -> Response: """ response = super().create(request, *args, **kwargs) response.status_code = getattr(self, "SUCCESS_STATUS_CODE", status.HTTP_200_OK) + + if response.status_code == status.HTTP_204_NO_CONTENT: + response.data = None + return response