Fix request cloning, so method becomes set

This commit is contained in:
Tom Christie 2015-09-17 16:34:03 +01:00
parent 566812ac0b
commit 4b4130e8b2
2 changed files with 3 additions and 9 deletions

View File

@ -86,7 +86,7 @@ def clone_request(request, method):
ret._full_data = request._full_data ret._full_data = request._full_data
ret._content_type = request._content_type ret._content_type = request._content_type
ret._stream = request._stream ret._stream = request._stream
ret._method = method ret.method = method
if hasattr(request, '_user'): if hasattr(request, '_user'):
ret._user = request._user ret._user = request._user
if hasattr(request, '_auth'): if hasattr(request, '_auth'):
@ -139,7 +139,6 @@ class Request(object):
self._data = Empty self._data = Empty
self._files = Empty self._files = Empty
self._full_data = Empty self._full_data = Empty
self._method = Empty
self._content_type = Empty self._content_type = Empty
self._stream = Empty self._stream = Empty

View File

@ -3,27 +3,22 @@ Tests for content parsing, and form-overloaded content parsing.
""" """
from __future__ import unicode_literals from __future__ import unicode_literals
import json
from io import BytesIO
import django import django
import pytest import pytest
from django.conf.urls import url from django.conf.urls import url
from django.contrib.auth import authenticate, login, logout from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.contrib.sessions.middleware import SessionMiddleware from django.contrib.sessions.middleware import SessionMiddleware
from django.core.handlers.wsgi import WSGIRequest
from django.test import TestCase from django.test import TestCase
from django.utils import six from django.utils import six
from rest_framework import status from rest_framework import status
from rest_framework.authentication import SessionAuthentication from rest_framework.authentication import SessionAuthentication
from rest_framework.parsers import ( from rest_framework.parsers import (
BaseParser, FormParser, JSONParser, MultiPartParser BaseParser, FormParser, MultiPartParser
) )
from rest_framework.request import Empty, Request from rest_framework.request import Request
from rest_framework.response import Response from rest_framework.response import Response
from rest_framework.settings import api_settings
from rest_framework.test import APIClient, APIRequestFactory from rest_framework.test import APIClient, APIRequestFactory
from rest_framework.views import APIView from rest_framework.views import APIView