@@ -75,11 +75,13 @@ func isValidEnvironment(ctx context.Context, env manifest.EnvironmentDefinition)
75
75
// canEstablishClassicConnection checks if a classic connection (via token) can be established. Scopes are not validated.
76
76
func canEstablishClassicConnection (ctx context.Context , env manifest.EnvironmentDefinition ) bool {
77
77
token := env .Auth .Token .Value .Value ()
78
+ additionalHeaders := environment .GetAdditionalHttpHeadersFromEnv ()
78
79
client , err := clients .Factory ().
79
80
WithClassicURL (env .URL .Value ).
80
81
WithAccessToken (token ).
81
82
WithRateLimiter (true ).
82
83
WithRetryOptions (& client .DefaultRetryOptions ).
84
+ WithCustomHeaders (additionalHeaders ).
83
85
CreateClassicClient ()
84
86
if err != nil {
85
87
report .GetReporterFromContextOrDiscard (ctx ).ReportLoading (report .StateError , fmt .Errorf ("could not create client %q (%s): %w" , env .Name , env .URL .Value , err ), "" , nil )
@@ -124,6 +126,7 @@ func handleAuthError(ctx context.Context, env manifest.EnvironmentDefinition, er
124
126
// CreateAccountClients gives back clients to use for specific accounts
125
127
func CreateAccountClients (ctx context.Context , manifestAccounts map [string ]manifest.Account ) (map [account.AccountInfo ]* accounts.Client , error ) {
126
128
concurrentRequestLimit := environment .GetEnvValueIntLog (environment .ConcurrentRequestsEnvKey )
129
+ additionalHeaders := environment .GetAdditionalHttpHeadersFromEnv ()
127
130
accClients := make (map [account.AccountInfo ]* accounts.Client , len (manifestAccounts ))
128
131
for _ , acc := range manifestAccounts {
129
132
oauthCreds := clientcredentials.Config {
@@ -138,7 +141,8 @@ func CreateAccountClients(ctx context.Context, manifestAccounts map[string]manif
138
141
WithUserAgent (client .DefaultMonacoUserAgent ).
139
142
WithRateLimiter (true ).
140
143
WithRetryOptions (& client .DefaultRetryOptions ).
141
- WithAccountURL (accountApiUrlOrDefault (acc .ApiUrl ))
144
+ WithAccountURL (accountApiUrlOrDefault (acc .ApiUrl )).
145
+ WithCustomHeaders (additionalHeaders )
142
146
143
147
if supportarchive .IsEnabled (ctx ) {
144
148
factory = factory .WithHTTPListener (& corerest.HTTPListener {Callback : trafficlogs .GetInstance ().LogToFiles })
@@ -218,7 +222,13 @@ func getDynatraceClassicURL(ctx context.Context, platformURL string, oauthCreds
218
222
}
219
223
}
220
224
221
- client , err := clients .Factory ().WithPlatformURL (platformURL ).WithOAuthCredentials (oauthCreds ).CreatePlatformClient (ctx )
225
+ additionalHeaders := environment .GetAdditionalHttpHeadersFromEnv ()
226
+ client , err := clients .Factory ().
227
+ WithPlatformURL (platformURL ).
228
+ WithOAuthCredentials (oauthCreds ).
229
+ WithCustomHeaders (additionalHeaders ).
230
+ CreatePlatformClient (ctx )
231
+
222
232
if err != nil {
223
233
return "" , err
224
234
}
@@ -231,9 +241,10 @@ func findSimpleClassicURL(ctx context.Context, platformURL string) (classicUrl s
231
241
return "" , false
232
242
}
233
243
244
+ additionalHeaders := environment .GetAdditionalHttpHeadersFromEnv ()
234
245
classicUrl = strings .Replace (platformURL , ".apps." , ".live." , 1 )
235
246
236
- client , err := clients .Factory ().WithClassicURL (classicUrl ).CreateClassicClient ()
247
+ client , err := clients .Factory ().WithClassicURL (classicUrl ).WithCustomHeaders ( additionalHeaders ). CreateClassicClient ()
237
248
if err != nil {
238
249
return "" , false
239
250
}
0 commit comments