diff --git a/pecan/core.py b/pecan/core.py index 8aa6dab..a31dd9d 100644 --- a/pecan/core.py +++ b/pecan/core.py @@ -312,7 +312,7 @@ class Pecan(object): valid_args = valid_args[len(args):] # handle wildcard arguments - if remainder: + if filter(None, remainder): if not argspec[1]: abort(404) args.extend(remainder) diff --git a/pecan/tests/test_rest.py b/pecan/tests/test_rest.py index 4935c00..ce855ee 100644 --- a/pecan/tests/test_rest.py +++ b/pecan/tests/test_rest.py @@ -863,3 +863,28 @@ class TestRestController(TestCase): r = app.get('/foos/bars/bazs/final/named') assert r.status_int == 200 assert r.body == 'NAMED' + + def test_post_with_kwargs_only(self): + + class RootController(RestController): + + @expose() + def get_all(self): + return 'INDEX' + + @expose('json') + def post(self, **kw): + return kw + + # create the app + app = TestApp(make_app(RootController())) + + r = app.get('/') + assert r.status_int == 200 + assert r.body == 'INDEX' + + kwargs = {'foo': 'bar', 'spam': 'eggs'} + r = app.post('/', kwargs) + assert r.status_int == 200 + assert r.namespace['foo'] == 'bar' + assert r.namespace['spam'] == 'eggs'