Skip to content

Commit

Permalink
Server: Add correct Content-Type header to fetch
Browse files Browse the repository at this point in the history
Old default header application/x-www-form-urlencoded caused 415
responsens from 1.0.0+ CouchDBs.
  • Loading branch information
nailor committed Sep 15, 2010
1 parent b86f99e commit fc1559c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion trombi/client.py
Expand Up @@ -109,6 +109,9 @@ def __init__(self, baseurl, fetch_args={}, io_loop=None):
if self.baseurl[-1] == '/':
self.baseurl = self.baseurl[:-1]
self._fetch_args = fetch_args
self._default_args = {
'headers': HTTPHeaders({'Content-Type': 'application/json'})
}
self.io_loop = io_loop

def _invalid_db_name(self, name):
Expand All @@ -119,7 +122,8 @@ def _invalid_db_name(self, name):

def _fetch(self, *args, **kwargs):
# just a convenince wrapper
fetch_args = self._fetch_args.copy()
fetch_args = self._default_args.copy()
fetch_args.update(self._fetch_args)
fetch_args.update(kwargs)
AsyncHTTPClient(io_loop=self.io_loop).fetch(*args, **fetch_args)

Expand Down

0 comments on commit fc1559c

Please sign in to comment.