﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
20574	Django Client Put Method Data is not Send	edwinlunando	nobody	"I want to test my REST API like this:


{{{
data = {
            'access_token': access_token.token
        }
response = self.client.put(reverse('api:update_user'), data)
}}}

The question is, how can I access my data or query string at request object from my view? request.POST, request.GET, request.body, and request.META QUERY_STRING is empty. After I looked into the client put code like this.


{{{
    def put(self, path, data='', content_type='application/octet-stream',
            **extra):
        ""Construct a PUT request.""
        return self.generic('PUT', path, data, content_type, **extra)

    def generic(self, method, path,
                data='', content_type='application/octet-stream', **extra):
        parsed = urlparse(path)
        data = force_bytes(data, settings.DEFAULT_CHARSET)
        r = {
            'PATH_INFO':      self._get_path(parsed),
            'QUERY_STRING':   force_str(parsed[4]),
            'REQUEST_METHOD': str(method),
        }
        if data:
            r.update({
                'CONTENT_LENGTH': len(data),
                'CONTENT_TYPE':   str(content_type),
                'wsgi.input':     FakePayload(data),
            })
        r.update(extra)
        return self.request(**r)
}}}

The data parameter is not added to query string like get method like.

{{{
    def get(self, path, data={}, **extra):
        ""Construct a GET request.""

        parsed = urlparse(path)
        r = {
            'CONTENT_TYPE':    str('text/html; charset=utf-8'),
            'PATH_INFO':       self._get_path(parsed),
            'QUERY_STRING':    urlencode(data, doseq=True) or force_str(parsed[4]),
            'REQUEST_METHOD':  str('GET'),
        }
        r.update(extra)
        return self.request(**r)
}}}

So, I think the PUT and DELETE method should behave the same like GET and POST method at client. The ""'QUERY_STRING':    urlencode(data, doseq=True) or force_str(parsed[4]),"" should be used at PUT and DELETE method."	Bug	closed	Testing framework	1.5	Normal	worksforme	Test, Client, Put, Data		Unreviewed	0	0	0	0	0	0
