in wvd-templates/diagnostics-sample/src/MSFT.WVD.Diagnostics.Common/Services/UserSessionService.cs [122:138]
private async Task<string> PostRequest(string url, string body, string accessToken)
{
var activityId = Guid.NewGuid().ToString();
_logger.LogInformation($"RDS Management api call to post request to url {url}. Activity Id:{activityId}");
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
client.DefaultRequestHeaders.Add("x-ms-correlation-id", activityId);
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, url);
StringContent content = new StringContent(body);
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
request.Content = content;
HttpResponseMessage response = await client.SendAsync(request);
_logger.LogInformation($"Received response from ActivityId:{activityId} Status:{response.StatusCode}");
return response.ReasonPhrase;
}
}