From 1dd5dd260fc50e9759dc0d4bdea4f587b6cc57b7 Mon Sep 17 00:00:00 2001 From: Dominik George <dominik.george@teckids.org> Date: Mon, 12 Oct 2020 14:50:19 +0200 Subject: [PATCH] Return ping response when leaving out method name --- bigbluebutton/django/urls.py | 3 ++- bigbluebutton/django/views.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bigbluebutton/django/urls.py b/bigbluebutton/django/urls.py index e9c6acd..6884005 100644 --- a/bigbluebutton/django/urls.py +++ b/bigbluebutton/django/urls.py @@ -3,5 +3,6 @@ from django.urls import path from .views import APIView urlpatterns = [ - path("api/<str:method>", APIView.as_view(), name="api_request"), + path("api/<str:method>", APIView.as_view()), + path("api", APIView.as_view()), ] diff --git a/bigbluebutton/django/views.py b/bigbluebutton/django/views.py index 81ca9b3..72fc70e 100644 --- a/bigbluebutton/django/views.py +++ b/bigbluebutton/django/views.py @@ -18,7 +18,7 @@ class APIView(View): # Set to False to mimic the reference implementation more closely _fix_status = True - def dispatch(self, request: HttpRequest, method: str) -> HttpResponse: + def dispatch(self, request: HttpRequest, method: str = "ping") -> HttpResponse: # Find API tokens to allow for this request site = get_current_site(request) api_tokens = APIToken.objects.filter(server_group__site=site) @@ -49,7 +49,7 @@ class APIView(View): # Proprietary extension for test purposes if method == "ping": return self._success( - "xInfraBluePong", "The API is working correctly and your request was valid." + "xInfraBluePong", "The API is working correctly and your request was valid.", {"version": "2.0"} ) # Create mutable copy of request args without checksum -- GitLab