slizadel/python-clouddb — pull request #5 by calebgroom (2013-03-01 08:09:54+00:00)
Title: Always specify an Accept Header

Repose was added infront of the Rackspace Cloud Databases API servers per the [release notes](http://docs.rackspace.com/cdb/api/v1.0/cdb-releasenotes/content/cdbv1.0.20.html) on Feb 28, 2013. Repose is now producing a 500 status code for all calls that are not specifying an Accept header.

Here's an example using:

```python
>>> import httplib2
>>> h = httplib2.Http()
>>> kwargs = {'headers': {'User-Agent': 'my-user-agent',
... 'X-Auth-Token': 'my-token'}}
>>> response, content = h.request(
... 'https://dfw.databases.api.rackspacecloud.com/v1.0/my-user-id/flavors/',
... 'GET',
... **kwargs)
>>>
>>> print 'RESPONSE:', response
RESPONSE: {'status': '500', 'content-length': '1823', 'via': '1.1 Repose (Repose/2.6.3)', 'server': 'Jetty(8.0.y.z-SNAPSHOT)', 'connection': 'close', 'date': 'Fri, 01 Mar 2013 07:27:42 GMT', 'content-type': 'text/plain'}
>>> print 'CONTENT:', content
CONTENT: Traceback (most recent call last):
File "/usr/lib/python2.6/dist-packages/eventlet/wsgi.py", line 336, in handle_one_response
result = self.application(self.environ, start_response)
File "/usr/lib/python2.6/dist-packages/newrelic-1.9.0.21/newrelic/api/web_transaction.py", line 563, in __call__
result = application(environ, _start_response)
File "/usr/lib/python2.6/dist-packages/newrelic-1.9.0.21/newrelic/api/object_wrapper.py", line 220, in __call__
self._nr_instance, args, kwargs)
File "/usr/lib/python2.6/dist-packages/newrelic-1.9.0.21/newrelic/api/function_trace.py", line 81, in literal_wrapper
return wrapped(*args, **kwargs)
File "/usr/lib/python2.6/dist-packages/reddwarf/common/wsgi.py", line 147, in __call__
return app(environ, start_response)
File "/usr/lib/python2.6/dist-packages/paste/urlmap.py", line 203, in __call__
return app(environ, start_response)
File "/usr/lib/python2.6/dist-packages/webob/dec.py", line 159, in __call__
return resp(environ, start_response)
File "/usr/lib/python2.6/dist-packages/webob/dec.py", line 147, in __call__
resp = self.call_func(req, *args, **self.kwargs)
File "/usr/lib/python2.6/dist-packages/webob/dec.py", line 208, in call_func
return self.func(req, *args, **kwargs)
File "/usr/lib/python2.6/dist-packages/reddwarf/common/wsgi.py", line 520, in __call__
content_type = req.best_match_content_type()
File "/usr/lib/python2.6/dist-packages/reddwarf/common/wsgi.py", line 175, in best_match_content_type
bm = self.accept.best_match(ctypes.keys())
File "/usr/lib/python2.6/dist-packages/webob/acceptparse.py", line 182, in best_match
if self._match(mask, offer):
File "/usr/lib/python2.6/dist-packages/webob/acceptparse.py", line 323, in _match
assert mask.endswith('/*')
AssertionError
```

This pull request sets an Accept header for all requests.