@@ -288,13 +288,8 @@ public async Task<QueryHandle> StartQueryAsync(string statement, StartQueryOptio
288288 throw new AnalyticsException ( "Server response is missing required 'requestID' or 'handle' fields." , errorContext ) ;
289289 }
290290
291- // Strip the leading path prefix from the handle
292- var handle = handlePath . StartsWith ( "/api/v1/request/status/" )
293- ? handlePath [ "/api/v1/request/status/" . Length ..]
294- : handlePath ;
295-
296- LogAsyncStartQuerySucceeded ( _logger , options . ClientContextId , _redactor . SystemData ( handle ) , _redactor . SystemData ( requestId ) , ( int ) response . StatusCode ) ;
297- return new QueryHandle ( handle , requestId , this ) ;
291+ LogAsyncStartQuerySucceeded ( _logger , options . ClientContextId , _redactor . SystemData ( handlePath ) , _redactor . SystemData ( requestId ) , ( int ) response . StatusCode ) ;
292+ return new QueryHandle ( handlePath , requestId , this ) ;
298293 }
299294 catch ( HttpRequestException httpRequestException )
300295 {
@@ -335,7 +330,10 @@ public async Task<QueryHandle> StartQueryAsync(string statement, StartQueryOptio
335330 var timeout = _clusterOptions . TimeoutOptions . DispatchTimeout ;
336331 var httpClient = CreateHttpClient ( timeout ) ;
337332
338- var statusUri = new Uri ( _baseUri , $ "api/v1/request/status/{ handle . RequestId } /{ handle . Handle } ") ;
333+ var statusUri = Uri . TryCreate ( handle . Handle , UriKind . Absolute , out var absUri )
334+ ? absUri
335+ : new Uri ( _baseUri , handle . Handle ) ;
336+
339337 var request = new HttpRequestMessage ( HttpMethod . Get , statusUri ) ;
340338
341339 LogFetchStatusRequest ( _logger , _redactor . SystemData ( statusUri ) , _redactor . SystemData ( handle . Handle ) ) ;
@@ -393,12 +391,7 @@ public async Task<QueryHandle> StartQueryAsync(string statement, StartQueryOptio
393391 throw new InvalidOperationException ( "Query status indicates success but no result handle was provided by the server." ) ;
394392 }
395393
396- // Strip the leading path prefix to get just the handle portion
397- var handlePath = resultHandle . StartsWith ( "/api/v1/request/result/" )
398- ? resultHandle [ "/api/v1/request/result/" . Length ..]
399- : resultHandle ;
400-
401- return new QueryResultHandle ( handlePath , handle . RequestId , this ) ;
394+ return new QueryResultHandle ( resultHandle , handle . RequestId , this ) ;
402395 }
403396 catch ( TaskCanceledException taskCanceledEx )
404397 {
@@ -412,7 +405,10 @@ public async Task<IQueryResult> FetchResultsAsync(string requestId, string handl
412405 var httpClient = CreateHttpClient ( timeout ) ;
413406 var deserializer = options . Deserializer ?? _clusterOptions . Deserializer ;
414407
415- var resultUri = new Uri ( _baseUri , $ "api/v1/request/result/{ handlePath } ") ;
408+ var resultUri = Uri . TryCreate ( handlePath , UriKind . Absolute , out var absUri )
409+ ? absUri
410+ : new Uri ( _baseUri , handlePath ) ;
411+
416412 var request = new HttpRequestMessage ( HttpMethod . Get , resultUri ) ;
417413
418414 LogFetchResultsRequest ( _logger , _redactor . SystemData ( resultUri ) , _redactor . SystemData ( handlePath ) ) ;
@@ -457,7 +453,10 @@ public async Task DiscardResultsAsync(string requestId, string handlePath, Disca
457453 var timeout = _clusterOptions . TimeoutOptions . DispatchTimeout ;
458454 var httpClient = CreateHttpClient ( timeout ) ;
459455
460- var resultUri = new Uri ( _baseUri , $ "api/v1/request/result/{ handlePath } ") ;
456+ var resultUri = Uri . TryCreate ( handlePath , UriKind . Absolute , out var absUri )
457+ ? absUri
458+ : new Uri ( _baseUri , handlePath ) ;
459+
461460 var request = new HttpRequestMessage ( HttpMethod . Delete , resultUri ) ;
462461
463462 LogDiscardResultsRequest ( _logger , _redactor . SystemData ( resultUri ) , _redactor . SystemData ( handlePath ) ) ;
0 commit comments