From 4b4130e8b248b127451a3481c07a7134cf024ad7 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Thu, 17 Sep 2015 16:34:03 +0100 Subject: [PATCH] Fix request cloning, so method becomes set --- rest_framework/request.py | 3 +-- tests/test_request.py | 9 ++------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/rest_framework/request.py b/rest_framework/request.py index 98a70eb3a..76bf496ce 100644 --- a/rest_framework/request.py +++ b/rest_framework/request.py @@ -86,7 +86,7 @@ def clone_request(request, method): ret._full_data = request._full_data ret._content_type = request._content_type ret._stream = request._stream - ret._method = method + ret.method = method if hasattr(request, '_user'): ret._user = request._user if hasattr(request, '_auth'): @@ -139,7 +139,6 @@ class Request(object): self._data = Empty self._files = Empty self._full_data = Empty - self._method = Empty self._content_type = Empty self._stream = Empty diff --git a/tests/test_request.py b/tests/test_request.py index c328460f3..49f99a832 100644 --- a/tests/test_request.py +++ b/tests/test_request.py @@ -3,27 +3,22 @@ Tests for content parsing, and form-overloaded content parsing. """ from __future__ import unicode_literals -import json -from io import BytesIO - import django import pytest from django.conf.urls import url from django.contrib.auth import authenticate, login, logout from django.contrib.auth.models import User from django.contrib.sessions.middleware import SessionMiddleware -from django.core.handlers.wsgi import WSGIRequest from django.test import TestCase from django.utils import six from rest_framework import status from rest_framework.authentication import SessionAuthentication 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.settings import api_settings from rest_framework.test import APIClient, APIRequestFactory from rest_framework.views import APIView