Permalink
Browse files

handle utf-8 in body when posting queries

  • Loading branch information...
1 parent 1359011 commit 88268fe1c63abff9efc930cc1719bb637ca6a4fd @hofmeister committed Jun 7, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 couchdb-external-hook.py
@@ -79,7 +79,7 @@ def respond(res, req, key):
method = req["verb"]
if method == "POST":
- res.request(method, path,req.get("body"),req_headers)
+ res.request(method, path,req.get("body").decode("utf-8"),req_headers)
else:
res.request(method, path, headers=req_headers)
resp = res.getresponse()
@@ -92,7 +92,7 @@ def respond(res, req, key):
return mkresp(resp.status, resp.read(), resp_headers)
def mkresp(code, body, headers=None):
- ret = {"code": code, "body": body}
+ ret = {"code": code, "body": body.encode("utf-8")}
if headers is not None:
ret["headers"] = headers
return ret

0 comments on commit 88268fe

Please sign in to comment.