Skip to content

Commit

Permalink
Decorator and content-type cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gmr committed May 13, 2015
1 parent 7fe5263 commit b8b0c6a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions consulate/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

LOGGER = logging.getLogger(__name__)

CONTENT_FORM = 'application/x-www-form-urlencoded; charset=UTF-8'
CONTENT_JSON = 'application/json; charset=UTF-8'
CONTENT_FORM = 'application/x-www-form-urlencoded; charset=utf-8'
CONTENT_JSON = 'application/json; charset=utf-8'


def prepare_data(fun):
Expand All @@ -31,8 +31,9 @@ def inner(*args, **kwargs):
:param dict kwargs: keyword arguments
"""
if kwargs.get('data') and not utils.is_string(kwargs.get('data')):
kwargs['data'] = json.dumps(kwargs['data'])
if kwargs.get('data'):
if not utils.is_string(kwargs.get('data')):
kwargs['data'] = json.dumps(kwargs['data'])
elif len(args) == 3 and not utils.is_string(args[2]):
args = args[0], args[1], json.dumps(args[2])
return fun(*args, **kwargs)
Expand Down

0 comments on commit b8b0c6a

Please sign in to comment.