This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Collections.Specialized; | |
using System.Linq; | |
using System.Net.Http.Headers; | |
using Newtonsoft.Json.Linq; | |
namespace HttpUtils | |
{ | |
public static class RestClient | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
useage: | |
var updateResult = await FaultRetryUtility.AsyncFaultRetry(() => _aManager.UpdateSomthing(Id, data), _logger); | |
will have to figure out your own log interface | |
*/ | |
using System; | |
using System.Configuration; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static HttpClient _client = new HttpClient(); | |
private static T HttpGet<T>(string url) | |
{ | |
var response = _client.GetAsync(url).GetAwaiter().GetResult(); | |
if (false == response.IsSuccessStatusCode) | |
{ | |
var responseContent = response.Content.ReadAsStringAsync(); |