Skip to content

Commit c9eead1

Browse files
authored
Merge pull request #11 from flavienbwk/develop
Updated key naming data => details
2 parents beb5963 + 8ff22aa commit c9eead1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

api/app/utils/ApiResponse.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class ApiResponse():
66
A class that formats correctly the expected
77
response from the web applicaiton.
88
9-
@author : github.com/flavienbwk | berwic_f
9+
@author : github.com/flavienbwk
1010
"""
1111

1212
def __init__(self) -> None:
@@ -38,13 +38,13 @@ def setDetails(self, details: dict) -> None:
3838
def setHTTPCode(self, http_code: int) -> None:
3939
self.http_code = http_code
4040

41-
def getResponse(self) -> {"http_code": int, "error": bool, "message": str, "data": {}}:
41+
def getResponse(self) -> {"http_code": int, "error": bool, "message": str, "details": {}}:
4242
return {
4343
"flask_api": True,
4444
"http_code": self.http_code,
4545
"error": self.error,
4646
"message": self.message,
47-
"data": self.details
47+
"details": self.details
4848
}
4949

5050
@staticmethod
@@ -56,7 +56,7 @@ def formatFlaskResponse(response):
5656
Switching from the Flask "errors" key to
5757
response format with "error" & "message".
5858
59-
Adding an empty "data" object if no details
59+
Adding an empty "details" object if no details
6060
are returned, to remain consistent.
6161
"""
6262
try:
@@ -76,8 +76,8 @@ def formatFlaskResponse(response):
7676
response_data["message"] = ApiResponse.stringifyFlaskErrors(response_data["errors"])
7777
response_data["error"] = True
7878
del(response_data["errors"])
79-
if "data" not in response_data:
80-
response_data["data"] = {}
79+
if "details" not in response_data:
80+
response_data["details"] = {}
8181
if "error" not in response_data:
8282
response_data["error"] = True
8383
if "http_code" in response_data:

0 commit comments

Comments
 (0)