From c7046df0f24aadbeb8e491a9b61c6cc4e49e59c6 Mon Sep 17 00:00:00 2001 From: Don Mitchell Date: Tue, 25 Jun 2013 11:29:41 -0400 Subject: [PATCH] Make request.POST be only json content when using expect_json --- common/djangoapps/util/json_request.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/djangoapps/util/json_request.py b/common/djangoapps/util/json_request.py index 840a8282f9..a9a0c39278 100644 --- a/common/djangoapps/util/json_request.py +++ b/common/djangoapps/util/json_request.py @@ -15,8 +15,7 @@ def expect_json(view_function): # e.g. 'charset', so we can't do a direct string compare if request.META.get('CONTENT_TYPE', '').lower().startswith("application/json"): cloned_request = copy.copy(request) - cloned_request.POST = cloned_request.POST.copy() - cloned_request.POST.update(json.loads(request.body)) + cloned_request.POST = json.loads(request.body) return view_function(cloned_request, *args, **kwargs) else: return view_function(request, *args, **kwargs)