File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -216,12 +216,16 @@ public partial class Kubernetes
216
216
webSocketBuilder . AddClientCertificate ( cert ) ;
217
217
}
218
218
219
- HttpRequestMessage message = new HttpRequestMessage ( ) ;
220
- await this . Credentials . ProcessHttpRequestAsync ( message , cancellationToken ) ;
221
-
222
- foreach ( var _header in message . Headers )
219
+ if ( this . Credentials != null )
223
220
{
224
- webSocketBuilder . SetRequestHeader ( _header . Key , string . Join ( " " , _header . Value ) ) ;
221
+ // Copy the default (credential-related) request headers from the HttpClient to the WebSocket
222
+ HttpRequestMessage message = new HttpRequestMessage ( ) ;
223
+ await this . Credentials . ProcessHttpRequestAsync ( message , cancellationToken ) ;
224
+
225
+ foreach ( var _header in message . Headers )
226
+ {
227
+ webSocketBuilder . SetRequestHeader ( _header . Key , string . Join ( " " , _header . Value ) ) ;
228
+ }
225
229
}
226
230
227
231
#if NETCOREAPP2_1
You can’t perform that action at this time.
0 commit comments