Check if hook exists
This commit is contained in:
parent
d319769fe0
commit
65f650f1ac
|
@ -93,7 +93,10 @@ class HookAPI(APIView):
|
||||||
return HttpResponse("OK")
|
return HttpResponse("OK")
|
||||||
|
|
||||||
def get(self, request, hook_name):
|
def get(self, request, hook_name):
|
||||||
hook = Hook.objects.get(name=hook_name)
|
try:
|
||||||
|
hook = Hook.objects.get(name=hook_name)
|
||||||
|
except Hook.DoesNotExist:
|
||||||
|
return HttpResponseBadRequest("Hook does not exist.")
|
||||||
|
|
||||||
return_data = {"name": hook.name, "hook": hook.hook, "hook_id": hook.id}
|
return_data = {"name": hook.name, "hook": hook.hook, "hook_id": hook.id}
|
||||||
return HttpResponse(orjson.dumps(return_data), content_type="application/json")
|
return HttpResponse(orjson.dumps(return_data), content_type="application/json")
|
||||||
|
|
Loading…
Reference in New Issue