You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
736 B
C#

using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Text;
using System.Threading.Tasks;
namespace CommonFunc.Tools
{
public class RestHelper
{
private readonly HttpClient _httpClient;
public RestHelper()
{
_httpClient = new HttpClient();
}
public async Task<string> PostAsync(string url, string jsonContent)
{
var httpContent = new StringContent(jsonContent, Encoding.UTF8, "application/json");
var response = await _httpClient.PostAsync(url, httpContent);
var responseContent = await response.Content.ReadAsStringAsync();
return responseContent;
}
}
}