[fix] important fix for argument handling
This commit is contained in:
parent
039bc2c8fe
commit
d0ec030ce9
|
@ -101,12 +101,12 @@ def args_check(fct):
|
||||||
for key in optional:
|
for key in optional:
|
||||||
if key in data_:
|
if key in data_:
|
||||||
data[key] = data_[key]
|
data[key] = data_[key]
|
||||||
else:
|
else:
|
||||||
""" Unsafe mode, without specified arguments, or plain text mode
|
""" Unsafe mode, without specified arguments, or plain text mode
|
||||||
"""
|
"""
|
||||||
data = data_
|
data = data_
|
||||||
|
|
||||||
kwargs['data'] = data
|
kwargs['data'] = data
|
||||||
|
|
||||||
out_s = req.scope.get('out')
|
out_s = req.scope.get('out')
|
||||||
if out_s:
|
if out_s:
|
||||||
|
|
|
@ -38,6 +38,10 @@ class TestDummyDomain(TestDomain):
|
||||||
assert res.headers['content-type'].split(';')[0] == 'text/html'
|
assert res.headers['content-type'].split(';')[0] == 'text/html'
|
||||||
|
|
||||||
def test_arguments__get_routes(self):
|
def test_arguments__get_routes(self):
|
||||||
|
res = self.client.post('/arguments?foo=1&x=3')
|
||||||
|
|
||||||
|
assert res.status_code == 400
|
||||||
|
|
||||||
arg_dict = {'foo': '1', 'bar': '2', 'x': '3'}
|
arg_dict = {'foo': '1', 'bar': '2', 'x': '3'}
|
||||||
res = self.client.get('/arguments?foo=1&bar=2&x=3')
|
res = self.client.get('/arguments?foo=1&bar=2&x=3')
|
||||||
assert res.json() == arg_dict
|
assert res.json() == arg_dict
|
||||||
|
@ -46,7 +50,22 @@ class TestDummyDomain(TestDomain):
|
||||||
assert res.json() == arg_dict
|
assert res.json() == arg_dict
|
||||||
|
|
||||||
def test_arguments_post_routes(self):
|
def test_arguments_post_routes(self):
|
||||||
arg_dict = {'foo': '1', 'bar': '2', 'baz': '3'}
|
arg_dict = {}
|
||||||
|
res = self.client.post('/arguments', arg_dict)
|
||||||
|
|
||||||
|
assert res.status_code == 400
|
||||||
|
|
||||||
|
arg_dict = {'foo': '1', 'bar': '3'}
|
||||||
|
res = self.client.post('/arguments', arg_dict)
|
||||||
|
|
||||||
|
assert res.status_code == 400
|
||||||
|
|
||||||
|
arg_dict = {'foo': '1', 'baz': '3'}
|
||||||
|
res = self.client.post('/arguments', arg_dict)
|
||||||
|
|
||||||
|
assert res.json() == arg_dict
|
||||||
|
|
||||||
|
arg_dict = {'foo': '1', 'baz': '3', 'truebidoo': '4'}
|
||||||
res = self.client.post('/arguments', arg_dict)
|
res = self.client.post('/arguments', arg_dict)
|
||||||
|
|
||||||
assert res.json() == arg_dict
|
assert res.json() == arg_dict
|
||||||
|
|
Loading…
Reference in New Issue