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
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user