File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -38,8 +38,7 @@ def build_response(data: CommandData):
38
38
"statusCode" : meta_data ['status' ],
39
39
"body" : meta_data ['result' ]
40
40
}
41
- if is_json (meta_data ['result' ]):
42
- result ['headers' ] = { 'Content-Type' : 'application/json' }
41
+ print (f"{ result } " )
43
42
return result
44
43
45
44
def parse_body (args ):
Original file line number Diff line number Diff line change @@ -46,8 +46,20 @@ def execute(self, input:CommandData):
46
46
try :
47
47
r = redis .from_url (self ._redis_url )
48
48
result = r .execute_command (input .command ())
49
- input .result (str (result .decode ('utf-8' )))
50
- input .status (200 )
49
+
50
+ if result :
51
+ input .status (200 )
52
+ # Ensure result is always a string
53
+ if isinstance (result , bytes ):
54
+ result = result .decode ("utf-8" )
55
+ else :
56
+ result = str (result )
57
+
58
+ input .result (result )
59
+ else :
60
+ input .status (204 )
61
+ input .result (None )
62
+
51
63
except Exception as e :
52
64
input .result (f"could not execute redis command { e } " )
53
65
input .status (400 )
You can’t perform that action at this time.
0 commit comments