Hi everyone,

I'm building a REST API and i need to use the Client.put() method. For 
example 

response = self.client.put(reverse('api:update_user'), {access_token: 
'123123123123'})

When I run the test, I do not know where the data is placed. request.GET 
and request.POST is empty. request.META['QUERY_STRING'] is empty. Where are 
my PUT data?

I tried to see the put method code and it shows 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 included to 'wsgi.input' not to QUERY_STRING. How can 
i access my data from the request object at my view?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to