Fix panic in non-generated API calls when printing as JSON (#1095)
Fixes #992
This commit is contained in:
1 parent
26c0c4479d
commit
f05f37d0fa
8 files changed
+21
-18
No files matched your search
@@ -57,10 +57,9 @@ func (c *Client) ChangePassword(ctx context.Context, accountId, currentPassword,
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error decoding ChangePassword response: %w", err)
|
||||
}
|
||||
|
||||
if apiErr != nil {
|
||||
return nil, apiErr
|
||||
}
|
||||
|
||||
target.response = resp
|
||||
return target, nil
|
||||
}
|
||||
@@ -59,6 +59,6 @@ func (c *Client) SetPassword(ctx context.Context, accountId, password string, ve
|
||||
if apiErr != nil {
|
||||
return nil, apiErr
|
||||
}
|
||||
|
||||
target.response = resp
|
||||
return target, nil
|
||||
}
|
||||
@@ -96,6 +96,5 @@ func (c *Client) Authenticate(ctx context.Context, authMethodId, command string,
|
||||
return nil, apiErr
|
||||
}
|
||||
target.response = resp
|
||||
|
||||
return target, nil
|
||||
}
|
||||
@@ -59,10 +59,9 @@ func (c *Client) ChangeState(ctx context.Context, authMethodId string, version u
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error decoding ChangeState response: %w", err)
|
||||
}
|
||||
|
||||
if apiErr != nil {
|
||||
return nil, apiErr
|
||||
}
|
||||
|
||||
target.response = resp
|
||||
return target, nil
|
||||
}
|
||||
@@ -63,14 +63,15 @@ func (c *Client) AuthorizeSession(ctx context.Context, targetId string, opt ...O
|
||||
return nil, fmt.Errorf("error performing client request during AuthorizeSession call: %w", err)
|
||||
}
|
||||
|
||||
sar := new(SessionAuthorizationResult)
|
||||
sar.Item = new(SessionAuthorization)
|
||||
apiErr, err := resp.Decode(sar.Item)
|
||||
target := new(SessionAuthorizationResult)
|
||||
target.Item = new(SessionAuthorization)
|
||||
apiErr, err := resp.Decode(target.Item)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error decoding AuthorizeSession response: %w", err)
|
||||
}
|
||||
if apiErr != nil {
|
||||
return nil, apiErr
|
||||
}
|
||||
return sar, nil
|
||||
target.response = resp
|
||||
return target, nil
|
||||
}
|
||||
Reference in new issue
Block a user