From 019ad244dacc21c3fe5d09ef382b3dec9a5f98c0 Mon Sep 17 00:00:00 2001 From: kim Date: Tue, 2 Apr 2024 11:26:29 +0100 Subject: [PATCH] add code comments for the new gtscontext functions --- internal/gtscontext/context.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/gtscontext/context.go b/internal/gtscontext/context.go index 795bfaca6..80ccb6330 100644 --- a/internal/gtscontext/context.go +++ b/internal/gtscontext/context.go @@ -129,11 +129,15 @@ func SetOtherIRIs(ctx context.Context, iris []*url.URL) context.Context { return context.WithValue(ctx, otherIRIsKey, iris) } +// HTTPClientSignFunc returns an httpclient signing function for the current client +// request context. This can be used to resign a request as calling transport's user. func HTTPClientSignFunc(ctx context.Context) func(*http.Request) error { fn, _ := ctx.Value(httpClientSignFnKey).(func(*http.Request) error) return fn } +// SetHTTPClientSignFunc stores the given httpclient signing function and returns the wrapped +// context. See HTTPClientSignFunc() for further information on the signing function value. func SetHTTPClientSignFunc(ctx context.Context, fn func(*http.Request) error) context.Context { return context.WithValue(ctx, httpClientSignFnKey, fn) }