-
Notifications
You must be signed in to change notification settings - Fork 108
Open
Labels
featurenew featuresnew features
Description
Hi, hope everyone is healthy and safe.
I have multiple views which are working with multiple request methods. For some of these views, I'ld like to update/replace/exclude the csp only for the request method. For example;
@csp_exempt(methods=["POST"])
def view(request):
if request.method == "GET":
result = do_get_with_default_csp(request)
elif request.method == "POST":
result = do_post_with_csp_excluded(request)
else:
raise InvalidRequestException()
return result
@csp_update(methods=["GET"], SCRIPT_SRC=["url"])
def another_view(request):
if request.method == "GET":
result = do_get_with_updated_csp(request)
elif request.method == "POST":
result = do_post_with_default_csp(request)
else:
raise InvalidRequestException()
return result
I hope I'm not the only one in need of such feature.
some1ataplace
Metadata
Metadata
Assignees
Labels
featurenew featuresnew features