MCPcopy
hub / github.com/AlistGo/alist / decode

Method decode

pkg/aria2/rpc/json2.go:60–77  ·  view source on GitHub ↗
(reply interface{})

Source from the content-addressed store, hash-verified

58}
59
60func (c clientResponse) decode(reply interface{}) error {
61 if c.Error != nil {
62 jsonErr := &Error{}
63 if err := json.Unmarshal(*c.Error, jsonErr); err != nil {
64 return &Error{
65 Code: E_SERVER,
66 Message: string(*c.Error),
67 }
68 }
69 return jsonErr
70 }
71
72 if c.Result == nil {
73 return ErrNullResult
74 }
75
76 return json.Unmarshal(*c.Result, reply)
77}
78
79// DecodeClientResponse decodes the response body of a client request into
80// the interface reply.

Callers 2

DecodeClientResponseFunction · 0.95
newWebsocketCallerFunction · 0.80

Calls 1

UnmarshalMethod · 0.45

Tested by

no test coverage detected