Skip to content

Commit

Permalink
Merge pull request microsoft#111 from microsoft/expose-generic-sendasyc
Browse files Browse the repository at this point in the history
expose a generic send async operation
  • Loading branch information
jeffj6123 authored Jun 22, 2022
2 parents e53bbf9 + 8af72c6 commit 739327f
Show file tree
Hide file tree
Showing 3 changed files with 233 additions and 183 deletions.
19 changes: 19 additions & 0 deletions src/Microsoft.ServiceFabric.Client.Http/ServiceFabricHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,25 @@ internal string ClientTypeHeaderValue
}
}

/// <summary>
/// Sends an HTTP get request to cluster http gateway.
/// </summary>
/// <param name="requestFunc">Func to create HttpRequest to send.</param>
/// <param name="relativeUri">Relative request Uri.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The payload of the GET response.</returns>
/// <exception cref="ServiceFabricException">When the response is not a success.</exception>
public override async Task<HttpResponseMessage> SendAsync(
Func<HttpRequestMessage> requestFunc,
string relativeUri,
CancellationToken cancellationToken)
{
var endpoint = this.randomizedEndpoints.GetElement();
var requestUri = new Uri(endpoint, relativeUri);
var requestId = Guid.NewGuid().ToString();
return await this.SendAsyncHandleUnsuccessfulResponse(requestFunc, requestUri, requestId, cancellationToken);
}

/// <summary>
/// Disposes resources.
/// </summary>
Expand Down
Loading

0 comments on commit 739327f

Please sign in to comment.