mirror of
https://github.com/netfun2000/rttys_zhaojh329.git
synced 2026-02-27 09:53:24 +08:00
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:
+3
-8
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user