1
0
Fork 0

chore: minor fixes

This commit is contained in:
Arthur K. 2026-01-23 11:13:44 +03:00
parent 0448f66ab2
commit 2af9e734dd
Signed by: wzray
GPG key ID: B97F30FDC4636357
6 changed files with 28 additions and 15 deletions

View file

@ -61,16 +61,16 @@ func (c *Client) Call(host string, path string, data any, out any) error {
return fmt.Errorf("http %d: %s", httpResponse.StatusCode, string(b))
}
var resp web.Response[json.RawMessage]
if err := json.NewDecoder(httpResponse.Body).Decode(&resp); err != nil {
return fmt.Errorf("decode response wrapper: %w", err)
}
if !resp.Ok {
return fmt.Errorf("error on the remote: %w", errors.New(resp.Err))
}
if out != nil {
var resp web.Response[json.RawMessage]
if err := json.NewDecoder(httpResponse.Body).Decode(&resp); err != nil {
return fmt.Errorf("decode response wrapper: %w", err)
}
if !resp.Ok {
return fmt.Errorf("error on the remote: %w", errors.New(resp.Err))
}
if err := json.Unmarshal(resp.Data, out); err != nil {
return fmt.Errorf("decode response body: %w", err)
}