From 94976df8d72f19c9052d365e4c4a40db48d9910a Mon Sep 17 00:00:00 2001 From: David Baumgold Date: Mon, 5 Aug 2013 14:16:26 -0400 Subject: [PATCH] Check that content-type starts with application/json When Chrome sends the AJAX request to add a user to the course team, it sets the Content-type to "application/json". However, when Firefox sends the same request, it sets the Content-type to "application/json; charset=UTF-8". This commit only checks that the Content-type begins with "application/json", not is identical to it; that way, Firefox can play, too. --- cms/djangoapps/contentstore/views/user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/views/user.py b/cms/djangoapps/contentstore/views/user.py index e1c75bad0f..5b38d47452 100644 --- a/cms/djangoapps/contentstore/views/user.py +++ b/cms/djangoapps/contentstore/views/user.py @@ -179,7 +179,7 @@ def course_team_user(request, org, course, name, email): return JsonResponse() # all other operations require the requesting user to specify a role - if request.META.get("CONTENT_TYPE", "") == "application/json" and request.body: + if request.META.get("CONTENT_TYPE", "").startswith("application/json") and request.body: try: payload = json.loads(request.body) except: