File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,8 +38,7 @@ def build_response(data: CommandData):
3838 "statusCode" : meta_data ['status' ],
3939 "body" : meta_data ['result' ]
4040 }
41- if is_json (meta_data ['result' ]):
42- result ['headers' ] = { 'Content-Type' : 'application/json' }
41+ print (f"{ result } " )
4342 return result
4443
4544def parse_body (args ):
Original file line number Diff line number Diff line change @@ -46,8 +46,20 @@ def execute(self, input:CommandData):
4646 try :
4747 r = redis .from_url (self ._redis_url )
4848 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+
5163 except Exception as e :
5264 input .result (f"could not execute redis command { e } " )
5365 input .status (400 )
You can’t perform that action at this time.
0 commit comments