derks/drest — Issue #9: Defect: passing parameters to ResourceHandler.get() method permanently stores the parameter
Author: aalcock
Created: 2012-03-10 04:29:23+00:00
State: open

Let's suppose I create a resource and call it:

```python
api = drest.API('http://localhost:8000/api/v1/')
api.add_resource('users')
api.users.get(params={'a', 'b'})
```

On all subsequent calls, the parameter a=b is resent.

Over time, each parameter key ever used builds up on the resource in the _extra_url_params dictionary slot.

This can be fixed in RequestHandler

```python
class RequestHandler(MetaMixin):

#

def request(self, method, path, params={}, headers={}):

#

# Start of change
#if method == 'GET':
# for key in params:
# self.add_url_param(key, params[key])
#
#if self._extra_url_params:
# url = "%s?%s" % (url, urlencode(self._extra_url_params))
if self._extra_url_params:
if params:
# request parameters are based on _extra_url_params but overwritten by params
req_params = dict(self._extra_url_params, **params)
else:
req_params = self._extra_url_params
else:
req_params = params

if req_params:
url = "%s?%s" % (url, urlencode(req_params))
# End of change

#
```