forked from TrueCloudLab/frostfs-api-go
[#337] client: Add option to specify callback of response information
There is a need to analyze some response information in API client. Define `ResponseMetaInfo` structure of response information. Add `WithResponseInfoHandler` client option which allows to set the response info callback. The callback is called right after any response is received. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
3844a3ac74
commit
da89c2b71f
8 changed files with 139 additions and 0 deletions
|
@ -55,6 +55,11 @@ func (c *clientImpl) CreateSession(ctx context.Context, expiration uint64, opts
|
|||
return nil, fmt.Errorf("transport error: %w", err)
|
||||
}
|
||||
|
||||
// handle response meta info
|
||||
if err := c.handleResponseInfoV2(callOptions, resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = v2signature.VerifyServiceMessage(resp)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("can't verify response message: %w", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue