@@ -10,10 +10,11 @@ import (
1010// These flags enable preview or experimental GitHub API features that are not yet GA.
1111type graphQLFeaturesKey struct {}
1212
13- // withGraphQLFeatures adds GraphQL feature flags to the context.
13+ // WithGraphQLFeatures adds GraphQL feature flags to the context.
1414// The flags are read by GraphQLFeaturesTransport and sent as the GraphQL-Features header.
15- // This is used internally by tool handlers that require experimental GitHub API features.
16- func withGraphQLFeatures (ctx context.Context , features ... string ) context.Context {
15+ // This is used by tool handlers that require experimental GitHub API features.
16+ // Remote servers can also use this function in tests to simulate feature flag contexts.
17+ func WithGraphQLFeatures (ctx context.Context , features ... string ) context.Context {
1718 return context .WithValue (ctx , graphQLFeaturesKey {}, features )
1819}
1920
@@ -30,7 +31,7 @@ func GetGraphQLFeatures(ctx context.Context) []string {
3031}
3132
3233// GraphQLFeaturesTransport is an http.RoundTripper that adds GraphQL-Features
33- // header based on context values set by withGraphQLFeatures .
34+ // header based on context values set by WithGraphQLFeatures .
3435//
3536// This transport should be used in the HTTP client chain for githubv4.Client
3637// to ensure GraphQL feature flags are properly sent to the GitHub API.
@@ -59,7 +60,7 @@ func GetGraphQLFeatures(ctx context.Context) []string {
5960// gqlClient := githubv4.NewClient(httpClient)
6061//
6162// The transport reads feature flags from request context using GetGraphQLFeatures.
62- // Feature flags are added to context by the tool handler via withGraphQLFeatures .
63+ // Feature flags are added to context by the tool handler via WithGraphQLFeatures .
6364type GraphQLFeaturesTransport struct {
6465 // Transport is the underlying http.RoundTripper. If nil, http.DefaultTransport is used.
6566 Transport http.RoundTripper
0 commit comments