diff --git a/src/HttpClientServiceHelper.Tests/Mock/Person.cs b/src/HttpClientServiceHelper.Tests/Mock/Person.cs index b9ce949..3c1fbcc 100644 --- a/src/HttpClientServiceHelper.Tests/Mock/Person.cs +++ b/src/HttpClientServiceHelper.Tests/Mock/Person.cs @@ -6,9 +6,9 @@ namespace HttpClientServiceHelper.Tests.Mock { public class Person { - private string FirstName { get; set; } - private string LastName { get; set; } - private string FullName => $"{FirstName} {LastName}"; + public string FirstName { get; set; } + public string LastName { get; set; } + public string FullName => $"{FirstName} {LastName}"; public static Person GetPerson() { diff --git a/src/HttpClientServiceHelper/Delete.cs b/src/HttpClientServiceHelper/Delete.cs index 7355b8e..827b2d7 100644 --- a/src/HttpClientServiceHelper/Delete.cs +++ b/src/HttpClientServiceHelper/Delete.cs @@ -33,7 +33,7 @@ public static async Task DeleteAsync(string Route, string T { using (HttpClient httpClient = new HttpClient()) { - httpClient.DefaultRequestHeaders.Authorization = string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; + httpClient.DefaultRequestHeaders.Authorization = !string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; var httpResponse = await httpClient.DeleteAsync(new Uri(Route)); return httpResponse; } @@ -101,7 +101,7 @@ public static async Task DeleteAndGetResponseAsStringAsync(string Route, { using (HttpClient httpClient = new HttpClient()) { - httpClient.DefaultRequestHeaders.Authorization = string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; + httpClient.DefaultRequestHeaders.Authorization = !string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; var httpResponse = await httpClient.DeleteAsync(new Uri(Route)); return await httpResponse.Content.ReadAsStringAsync(); } @@ -195,7 +195,7 @@ public static async Task DeleteAndGetResponseAsStringAsync(string Route, //{ // using (HttpClient httpClient = new HttpClient()) // { - // httpClient.DefaultRequestHeaders.Authorization = string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; + // httpClient.DefaultRequestHeaders.Authorization = !string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; // var httpResponse = await httpClient.DeleteAsync(new Uri(Route)); // if (httpResponse.IsSuccessStatusCode) // { diff --git a/src/HttpClientServiceHelper/Get.cs b/src/HttpClientServiceHelper/Get.cs index bedea05..4e7f579 100644 --- a/src/HttpClientServiceHelper/Get.cs +++ b/src/HttpClientServiceHelper/Get.cs @@ -62,7 +62,7 @@ public partial class HttpClientHelper //{ // using (HttpClient httpClient = new HttpClient()) // { - // httpClient.DefaultRequestHeaders.Authorization = string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; + // httpClient.DefaultRequestHeaders.Authorization = !string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; // var httpResponse = await httpClient.GetAsync(new Uri(Route)); // if (httpResponse.IsSuccessStatusCode) // { @@ -208,7 +208,7 @@ public static async Task GetAsync(string Route, string Toke { using (HttpClient httpClient = new HttpClient()) { - httpClient.DefaultRequestHeaders.Authorization = string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; + httpClient.DefaultRequestHeaders.Authorization = !string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; var httpResponse = await httpClient.GetAsync(new Uri(Route)); return httpResponse; } @@ -276,7 +276,7 @@ public static async Task GetAsStringAsync(string Route, string Token = n { using (HttpClient httpClient = new HttpClient()) { - httpClient.DefaultRequestHeaders.Authorization = string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; + httpClient.DefaultRequestHeaders.Authorization = !string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; var httpResponse = await httpClient.GetAsync(new Uri(Route)); return await httpResponse.Content.ReadAsStringAsync(); } diff --git a/src/HttpClientServiceHelper/Patch.cs b/src/HttpClientServiceHelper/Patch.cs index d942248..b9ad35e 100644 --- a/src/HttpClientServiceHelper/Patch.cs +++ b/src/HttpClientServiceHelper/Patch.cs @@ -40,7 +40,7 @@ public static async Task PatchAsync(string Route, object Mo using (HttpClient httpClient = new HttpClient()) { var uri = new Uri(Route); - httpClient.DefaultRequestHeaders.Authorization = string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; + httpClient.DefaultRequestHeaders.Authorization = !string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; string jsonTransport = JsonConvert.SerializeObject(Model); var jsonPayload = new StringContent(jsonTransport, Encoding.UTF8, "application/json"); var httpResponse = await httpClient.PatchAsync(uri, jsonPayload); @@ -124,7 +124,7 @@ public static async Task PatchAndGetResponseAsStringAsync(string Route, using (HttpClient httpClient = new HttpClient()) { var uri = new Uri(Route); - httpClient.DefaultRequestHeaders.Authorization = string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; + httpClient.DefaultRequestHeaders.Authorization = !string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; string jsonTransport = JsonConvert.SerializeObject(Model); var jsonPayload = new StringContent(jsonTransport, Encoding.UTF8, "application/json"); var httpResponse = await httpClient.PatchAsync(uri, jsonPayload); @@ -234,7 +234,7 @@ public static async Task PatchAndGetResponseAsStringAsync(string Route, // using (HttpClient httpClient = new HttpClient()) // { // var uri = new Uri(Route); - // httpClient.DefaultRequestHeaders.Authorization = string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; + // httpClient.DefaultRequestHeaders.Authorization = !string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; // string jsonTransport = JsonConvert.SerializeObject(Model); // var jsonPayload = new StringContent(jsonTransport, Encoding.UTF8, "application/json"); // var httpResponse = await httpClient.PatchAsync(uri, jsonPayload); diff --git a/src/HttpClientServiceHelper/Post.cs b/src/HttpClientServiceHelper/Post.cs index e8c0593..6e8b114 100644 --- a/src/HttpClientServiceHelper/Post.cs +++ b/src/HttpClientServiceHelper/Post.cs @@ -40,7 +40,7 @@ public static async Task PostAsync(string Route, object Mod using (HttpClient httpClient = new HttpClient()) { var uri = new Uri(Route); - httpClient.DefaultRequestHeaders.Authorization = string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; + httpClient.DefaultRequestHeaders.Authorization = !string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; string jsonTransport = JsonConvert.SerializeObject(Model); var jsonPayload = new StringContent(jsonTransport, Encoding.UTF8, "application/json"); var httpResponse = await httpClient.PostAsync(uri, jsonPayload); @@ -124,7 +124,7 @@ public static async Task PostAndGetResponseAsStringAsync(string Route, o using (HttpClient httpClient = new HttpClient()) { var uri = new Uri(Route); - httpClient.DefaultRequestHeaders.Authorization = string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; + httpClient.DefaultRequestHeaders.Authorization = !string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; string jsonTransport = JsonConvert.SerializeObject(Model); var jsonPayload = new StringContent(jsonTransport, Encoding.UTF8, "application/json"); var httpResponse = await httpClient.PostAsync(uri, jsonPayload); @@ -234,7 +234,7 @@ public static async Task PostAndGetResponseAsStringAsync(string Route, o // using (HttpClient httpClient = new HttpClient()) // { // var uri = new Uri(Route); - // httpClient.DefaultRequestHeaders.Authorization = string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; + // httpClient.DefaultRequestHeaders.Authorization = !string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; // string jsonTransport = JsonConvert.SerializeObject(Model); // var jsonPayload = new StringContent(jsonTransport, Encoding.UTF8, "application/json"); // var httpResponse = await httpClient.PostAsync(uri, jsonPayload); diff --git a/src/HttpClientServiceHelper/Put.cs b/src/HttpClientServiceHelper/Put.cs index 720b682..2f10f2f 100644 --- a/src/HttpClientServiceHelper/Put.cs +++ b/src/HttpClientServiceHelper/Put.cs @@ -40,7 +40,7 @@ public static async Task PutAsync(string Route, object Mode using (HttpClient httpClient = new HttpClient()) { var uri = new Uri(Route); - httpClient.DefaultRequestHeaders.Authorization = string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; + httpClient.DefaultRequestHeaders.Authorization = !string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; string jsonTransport = JsonConvert.SerializeObject(Model); var jsonPayload = new StringContent(jsonTransport, Encoding.UTF8, "application/json"); var httpResponse = await httpClient.PutAsync(uri, jsonPayload); @@ -124,7 +124,7 @@ public static async Task PutAndGetResponseAsStringAsync(string Route, ob using (HttpClient httpClient = new HttpClient()) { var uri = new Uri(Route); - httpClient.DefaultRequestHeaders.Authorization = string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; + httpClient.DefaultRequestHeaders.Authorization = !string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; string jsonTransport = JsonConvert.SerializeObject(Model); var jsonPayload = new StringContent(jsonTransport, Encoding.UTF8, "application/json"); var httpResponse = await httpClient.PutAsync(uri, jsonPayload); @@ -234,7 +234,7 @@ public static async Task PutAndGetResponseAsStringAsync(string Route, ob // using (HttpClient httpClient = new HttpClient()) // { // var uri = new Uri(Route); - // httpClient.DefaultRequestHeaders.Authorization = string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; + // httpClient.DefaultRequestHeaders.Authorization = !string.IsNullOrEmpty(Token) ? new AuthenticationHeaderValue("Bearer", Token) : null; // string jsonTransport = JsonConvert.SerializeObject(Model); // var jsonPayload = new StringContent(jsonTransport, Encoding.UTF8, "application/json"); // var httpResponse = await httpClient.PutAsync(uri, jsonPayload);