summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChmouel Boudjnah <chmouel@enovance.com>2014-10-28 13:36:54 +0100
committerChmouel Boudjnah <chmouel@enovance.com>2014-10-28 14:25:08 +0100
commit611272a89c0965aa0a311399f1edf9ead7c5d285 (patch)
tree74e64bcf63ccc0ae783a711f287058967d2c2e38
parentc7f241fd6bb8a0b10e02b8b43aaf1810c312cfbf (diff)
downloadpecan-611272a89c0965aa0a311399f1edf9ead7c5d285.tar.gz
Only define remainder when not empty
I had an issue using a post method on a /path/ since get_args will set me up with a first empty argument of an empty string and eat my first argument with it. Change-Id: Ieb2f192127c1fca430f1376e5bdb2be863fe6920
-rw-r--r--pecan/core.py2
-rw-r--r--pecan/tests/test_base.py5
2 files changed, 6 insertions, 1 deletions
diff --git a/pecan/core.py b/pecan/core.py
index 49c7e8e..4a2c9be 100644
--- a/pecan/core.py
+++ b/pecan/core.py
@@ -344,7 +344,7 @@ class PecanBase(object):
return unquote_plus(x) if isinstance(x, six.string_types) \
else x
- remainder = [_decode(x) for x in remainder]
+ remainder = [_decode(x) for x in remainder if x]
if im_self is not None:
args.append(im_self)
diff --git a/pecan/tests/test_base.py b/pecan/tests/test_base.py
index b22b2c8..a18981c 100644
--- a/pecan/tests/test_base.py
+++ b/pecan/tests/test_base.py
@@ -928,6 +928,11 @@ class TestControllerArguments(PecanTestCase):
assert r.status_int == 200
assert r.body == b_('eater: 9, None, day=12, month=1')
+ def test_post_empty_remainder_with_json_kwargs(self):
+ r = self.app_.post_json('/eater/9/', {'month': '1', 'day': '12'})
+ assert r.status_int == 200
+ assert r.body == b_('eater: 9, None, day=12, month=1')
+
def test_post_remainder_with_json_kwargs(self):
r = self.app_.post_json('/eater/9', {'month': '1', 'day': '12'})
assert r.status_int == 200