Skip to content

Commit

Permalink
If body empty, replace '{}' returned by json.dumps with empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
mepley1 committed Apr 21, 2024
1 parent 55cdbd9 commit a5e2a91
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions project/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ def index(u_path):
try:
logging.debug('Serialize form data...')
req_body = json.dumps(dict(request.form)) #This is resulting in an empty string if it can't parse it
if req_body == '{}':
req_body = ''
except TypeError as e:
logging.debug('Form data not serializable, trying get_data()...')
req_body = request.get_data().decode('utf-8', errors = 'replace')
Expand Down

0 comments on commit a5e2a91

Please sign in to comment.