From 6226f070f0c60c34ee1ccf435c26e5659d1ea054 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Thu, 25 Jan 2018 06:40:31 -0500 Subject: [PATCH] Fix setting post/files on the underlying request --- rest_framework/request.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rest_framework/request.py b/rest_framework/request.py index 199df7c34..2339712b7 100644 --- a/rest_framework/request.py +++ b/rest_framework/request.py @@ -295,10 +295,11 @@ class Request(object): else: self._full_data = self._data - # copy data & files refs to the underlying request so that closable - # objects are handled appropriately. - self.http_request._post = self.POST - self.http_request._files = self.FILES + # if a form media type, copy data & files refs to the underlying + # http request so that closable objects are handled appropriately. + if is_form_media_type(self.content_type): + self.http_request._post = self.POST + self.http_request._files = self.FILES def _load_stream(self): """