From e3ad2a27c3102f152b70e3e442a3e72da34441b1 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Sat, 27 Oct 2018 18:14:52 +0200 Subject: [PATCH] Use proper HttpRequest object to call a Django view --- readthedocs/restapi/views/integrations.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/readthedocs/restapi/views/integrations.py b/readthedocs/restapi/views/integrations.py index f2ec92dd0..35e5fab11 100644 --- a/readthedocs/restapi/views/integrations.py +++ b/readthedocs/restapi/views/integrations.py @@ -343,4 +343,8 @@ class WebhookView(APIView): ) view_cls = self.VIEW_MAP[integration.integration_type] view = view_cls.as_view(integration=integration) - return view(request, project_slug) + # DRF uses ``rest_framework.request.Request`` and Django expects + # ``django.http.HttpRequest`` + # https://www.django-rest-framework.org/api-guide/requests/ + # https://github.com/encode/django-rest-framework/pull/5771#issuecomment-362815342 + return view(request._request, project_slug)