From 76a7bbf5af919b42ec14e29e32a22bfbaa532b6c Mon Sep 17 00:00:00 2001 From: kgriffs Date: Tue, 31 Dec 2013 17:44:04 -0600 Subject: [PATCH] fix(testing): Encode environ path to str in Python 2 --- falcon/testing/helpers.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/falcon/testing/helpers.py b/falcon/testing/helpers.py index 7c955a7..4e028e6 100644 --- a/falcon/testing/helpers.py +++ b/falcon/testing/helpers.py @@ -84,6 +84,9 @@ def create_environ(path='/', query_string='', protocol='HTTP/1.1', port='80', body = io.BytesIO(body.encode('utf-8') if isinstance(body, six.text_type) else body) + if six.PY2 and isinstance(path, unicode): + path = path.encode('utf-8') + env = { 'SERVER_PROTOCOL': protocol, 'SERVER_SOFTWARE': 'gunicorn/0.17.0',