Skip to content

Commit

Permalink
Update response structure to return None for empty data in add_status…
Browse files Browse the repository at this point in the history
… function
  • Loading branch information
Vianpyro committed Nov 13, 2024
1 parent 70be486 commit 713c7bd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ def server_time():
def add_status(response):
if response.is_json:
original_data = response.get_json()
new_response = {"success": response.status_code == 200, "data": original_data}
new_response = {
"success": response.status_code == 200,
"data": original_data if original_data != [] else None,
}
response.set_data(jsonify(new_response).data)
return response

Expand Down

0 comments on commit 713c7bd

Please sign in to comment.