mirror of
https://github.com/fumiama/go-onebot-agent.git
synced 2026-06-16 08:20:28 +08:00
fix: marshal APIResponse error
This commit is contained in:
3
types.go
3
types.go
@@ -51,6 +51,9 @@ type APIResponse struct {
|
||||
// String dumps JSON without tailing \n
|
||||
func (resp *APIResponse) String() string {
|
||||
sb := strings.Builder{}
|
||||
if len(resp.Data) == 0 {
|
||||
resp.Data = []byte(`null`)
|
||||
}
|
||||
err := json.NewEncoder(&sb).Encode(resp)
|
||||
if err != nil {
|
||||
panic(errors.Wrap(err, "unexpected"))
|
||||
|
||||
Reference in New Issue
Block a user