Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using RestSharp;

namespace ReadMe.HarJsonTranslationLogics
{
Expand All @@ -20,19 +19,19 @@ public void SendHarObjToReadMeApi(bool fireAndForget)
{
try
{
var client = new RestClient(ConstValues.ReadmeAPIEndpoints);
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
var client = new HttpClient();

var request = new HttpRequestMessage(HttpMethod.Post, ConstValues.ReadmeAPIEndpoints);
string apiKey = "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(this.apiKey + ":"));
request.AddHeader("Authorization", apiKey);
request.AddParameter("application/json", this.harJsonObjects, ParameterType.RequestBody);
request.Headers.Add("Authorization", apiKey);
request.Content = new StringContent(this.harJsonObjects, Encoding.UTF8, "application/json");
if (fireAndForget)
{
client.ExecuteAsync(request);
client.SendAsync(request);
}
else
{
client.Execute(request);
client.SendAsync(request).GetAwaiter().GetResult();
}
}
catch (Exception)
Expand Down
1 change: 0 additions & 1 deletion packages/dotnet/ReadMe/ReadMe.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="RestSharp" Version="106.13.0" />

<FrameworkReference Include="Microsoft.AspNetCore.App" />

Expand Down
Loading