Custom micro client

This commit is contained in:
Ben Toogood
2020-05-14 11:25:19 +01:00
parent 5764519f5b
commit 1b18730d54
4 changed files with 29 additions and 26 deletions

View File

@@ -132,8 +132,6 @@ func TraceHandler(t trace.Tracer) server.HandlerWrapper {
type authWrapper struct {
client.Client
name string
id string
auth func() auth.Auth
}
@@ -170,8 +168,8 @@ func (a *authWrapper) Call(ctx context.Context, req client.Request, rsp interfac
}
// AuthClient wraps requests with the auth header
func AuthClient(name string, id string, auth func() auth.Auth, c client.Client) client.Client {
return &authWrapper{c, name, id, auth}
func AuthClient(auth func() auth.Auth, c client.Client) client.Client {
return &authWrapper{c, auth}
}
// AuthHandler wraps a server handler to perform auth