コード例 #1
0
        private async Task <HttpResponseMessage> SendAsync(HttpMethod method, TelemetryPayload payload)
        {
            var request = new HttpRequestMessage(method, "sonarlint")
            {
                Content = new StringContent(TelemetryHelper.Serialize(payload), Encoding.UTF8, "application/json")
            };

            return(await this.client.SendAsync(request).ConfigureAwait(false));
        }
コード例 #2
0
 public async Task <bool> SendPayloadAsync(TelemetryPayload payload)
 {
     return(await RetryHelper.RetryOnExceptionAsync(maxRetries, retryTimeout,
                                                    async() =>
     {
         var response = await SendAsync(HttpMethod.Post, payload);
         response.EnsureSuccessStatusCode();
     }));
 }
コード例 #3
0
 public async Task <bool> SendPayload(TelemetryPayload payload)
 {
     return(await RetryHelper.RetryOnExceptionAsync(3, TimeSpan.FromSeconds(2),
                                                    async() =>
     {
         var response = await SendAsync(HttpMethod.Post, payload);
         response.EnsureSuccessStatusCode();
     }));
 }
コード例 #4
0
 public static string Serialize(TelemetryPayload payload)
 {
     return(JsonHelper.Serialize(payload));
 }