mirror of
https://github.com/akyaiy/GoSally-mvp.git
synced 2026-01-03 08:52:24 +00:00
fix the use of empty fields in the response
This commit is contained in:
@@ -37,7 +37,9 @@ func NewError(code int, message string, data any, id *json.RawMessage) *RPCRespo
|
|||||||
Error = map[string]any{
|
Error = map[string]any{
|
||||||
"code": code,
|
"code": code,
|
||||||
"message": message,
|
"message": message,
|
||||||
"data": data,
|
}
|
||||||
|
if data != nil {
|
||||||
|
Error["data"] = data
|
||||||
}
|
}
|
||||||
|
|
||||||
return &RPCResponse{
|
return &RPCResponse{
|
||||||
|
|||||||
@@ -186,11 +186,6 @@ func (h *HandlerV1) handleLUA(sid string, r *http.Request, req *rpc.RPCRequest,
|
|||||||
L.SetField(scriptDataTable, "result", resTable)
|
L.SetField(scriptDataTable, "result", resTable)
|
||||||
L.SetField(outTable, "send", L.NewFunction(func(L *lua.LState) int {
|
L.SetField(outTable, "send", L.NewFunction(func(L *lua.LState) int {
|
||||||
res := L.Get(1)
|
res := L.Get(1)
|
||||||
if res == lua.LNil {
|
|
||||||
__exit = 0
|
|
||||||
L.RaiseError("__successfull")
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
resFTable := scriptDataTable.RawGetString("result")
|
resFTable := scriptDataTable.RawGetString("result")
|
||||||
if resPTable, ok := res.(*lua.LTable); ok {
|
if resPTable, ok := res.(*lua.LTable); ok {
|
||||||
|
|||||||
Reference in New Issue
Block a user