mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Account for no POST data
The serving.request doesn't include a raw_body when the POST data is blank, so set it to an empty dict. Also fixed a bug where we assumed that if data wasn't a list, it was a dict, which bombs because null POSTS result in None.
This commit is contained in:
parent
f40c617bad
commit
092f441cad
1 changed files with 4 additions and 2 deletions
|
@ -608,7 +608,7 @@ def lowdata_fmt():
|
|||
# if the data was sent as urlencoded, we need to make it a list.
|
||||
# this is a very forgiving implementation as different clients set different
|
||||
# headers for form encoded data (including charset or something similar)
|
||||
if not isinstance(data, list):
|
||||
if data and not isinstance(data, list):
|
||||
# Make the 'arg' param a list if not already
|
||||
if 'arg' in data and not isinstance(data['arg'], list):
|
||||
data['arg'] = [data['arg']]
|
||||
|
@ -2132,7 +2132,9 @@ class Webhook(object):
|
|||
'''
|
||||
tag = '/'.join(itertools.chain(self.tag_base, args))
|
||||
data = cherrypy.serving.request.unserialized_data
|
||||
raw_body = cherrypy.serving.request.raw_body
|
||||
if not data:
|
||||
data = {}
|
||||
raw_body = getattr(cherrypy.serving.request, 'raw_body', '')
|
||||
headers = dict(cherrypy.request.headers)
|
||||
|
||||
ret = self.event.fire_event({
|
||||
|
|
Loading…
Add table
Reference in a new issue