servicechecker/pkg/httpconn/httpconn.go
Vasiliy Tolstov 4d7bfa713a add multi user config field, fixup request-id generation
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2024-11-17 18:54:44 +03:00

26 lines
592 B
Go

package httpconn
import (
"context"
"time"
"go.unistack.org/micro/v3/client"
"go.unistack.org/micro/v3/logger"
)
func Call(ctx context.Context, rquid string, l logger.Logger, c client.Client, addr string, td time.Duration, req client.Request, rsp interface{}, opts ...client.CallOption) error {
var err error
err = c.Call(ctx, req, rsp,
client.WithAddress(addr),
client.WithRequestTimeout(td),
// client.WithContentType("application/json"),
)
if err != nil {
// httpcli.GetError(err)
l.Error(ctx, "call failed", "x-request-id", rquid, err)
return err
}
return nil
}