Use json.RawMessage for command response attrs

This fixes handling of error responses like `{"token":"token","attrs":{"err":1,"msg":"xx"}}`.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
This commit is contained in:
Jianhui Zhao
2025-07-13 19:57:56 +08:00
parent 98023ee54d
commit 346065a428
+3 -8
View File
@@ -26,6 +26,7 @@ package main
import (
"context"
"encoding/json"
"net/http"
"rttys/utils"
"strconv"
@@ -48,15 +49,9 @@ type CommandReqInfo struct {
Params []string `json:"params"`
}
type CommandRespAttrs struct {
Code int `json:"code"`
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
}
type CommandRespInfo struct {
Token string `json:"token"`
Attrs CommandRespAttrs `json:"attrs"`
Token string `json:"token"`
Attrs json.RawMessage `json:"attrs"`
}
const (