@@ -353,8 +353,9 @@ public async Task<ValueTuple<SPDYConnection, HttpResponseHeaders>> OpenSPDYAsync
353
353
HttpResponseMessage respMsg = await client . SendAsync ( reqMsg , HttpCompletionOption . ResponseHeadersRead , cancelToken ) . ConfigureAwait ( false ) ;
354
354
if ( respMsg . StatusCode != HttpStatusCode . SwitchingProtocols )
355
355
{
356
- throw new HttpRequestException (
357
- "Unable to upgrade to SPDY/3.1 connection. " + await respMsg . Content . ReadAsStringAsync ( ) . ConfigureAwait ( false ) ) ;
356
+ throw new KubernetesException ( new V1Status ( ) {
357
+ Status = "Failure" , Code = ( int ) respMsg . StatusCode , Reason = respMsg . StatusCode . ToString ( ) ,
358
+ Message = "Unable to upgrade to SPDY/3.1 connection. " + await respMsg . Content . ReadAsStringAsync ( ) . ConfigureAwait ( false ) } ) ;
358
359
}
359
360
360
361
Stream stream = await respMsg . Content . ReadAsStreamAsync ( ) . ConfigureAwait ( false ) ;
@@ -375,8 +376,9 @@ public async Task<ValueTuple<WebSocket, HttpResponseHeaders>> OpenWebSocketAsync
375
376
HttpResponseMessage respMsg = await client . SendAsync ( reqMsg , HttpCompletionOption . ResponseHeadersRead , cancelToken ) . ConfigureAwait ( false ) ;
376
377
if ( respMsg . StatusCode != HttpStatusCode . SwitchingProtocols )
377
378
{
378
- throw new HttpRequestException (
379
- "Unable to upgrade to web socket connection. " + await respMsg . Content . ReadAsStringAsync ( ) . ConfigureAwait ( false ) ) ;
379
+ throw new KubernetesException ( new V1Status ( ) {
380
+ Status = "Failure" , Code = ( int ) respMsg . StatusCode , Reason = respMsg . StatusCode . ToString ( ) ,
381
+ Message = "Unable to upgrade to web socket connection. " + await respMsg . Content . ReadAsStringAsync ( ) . ConfigureAwait ( false ) } ) ;
380
382
}
381
383
Stream stream = await respMsg . Content . ReadAsStreamAsync ( ) . ConfigureAwait ( false ) ;
382
384
return ( WebSocket . CreateFromStream ( stream , false , subprotocol , WebSocket . DefaultKeepAliveInterval ) , respMsg . Headers ) ;
0 commit comments