      def options(self, path, data=None, format=None, content_type=None, **extra):
          data, content_type = self._encode_data(data, format, content_type)
          return self.generic('OPTIONS', path, data, content_type, **extra)
  
      def request(self, **kwargs):
          request = super(APIRequestFactory, self).request(**kwargs)
          request._dont_enforce_csrf_checks = not self.enforce_csrf_checks
          return request
 
</s> remove             if media_type and not is_form_media_type(media_type):
 </s> add             if media_type and is_form_media_type(media_type): </s> remove         assert request.content_type == 'application/json'
 </s> add         assert request.META['CONTENT_TYPE'] == 'application/json'
    def generic(self, method, path, data='',
                content_type='application/octet-stream', secure=False, **extra):
        # Include the CONTENT_TYPE, regardless of whether or not data is empty.
        if content_type is not None:
            extra['CONTENT_TYPE'] = str(content_type)

        return super(APIRequestFactory, self).generic(
            method, path, data, content_type, secure, **extra)

      def options(self, path, data=None, format=None, content_type=None, **extra):
          data, content_type = self._encode_data(data, format, content_type)
          return self.generic('OPTIONS', path, data, content_type, **extra)
  
    def generic(self, method, path, data='',
                content_type='application/octet-stream', secure=False, **extra):
        # Include the CONTENT_TYPE, regardless of whether or not data is empty.
        if content_type is not None:
            extra['CONTENT_TYPE'] = str(content_type)

        return super(APIRequestFactory, self).generic(
            method, path, data, content_type, secure, **extra)

      def request(self, **kwargs):
          request = super(APIRequestFactory, self).request(**kwargs)
          request._dont_enforce_csrf_checks = not self.enforce_csrf_checks
          return request
keep keep keep add keep keep keep keep
 Force content_type inclusion in APIRequestFactory 
rest_framework/test.py