初始化代码

This commit is contained in:
admin
2020-12-18 13:51:58 +08:00
parent 42e945036f
commit abb13c805d
13 changed files with 316 additions and 72 deletions

27
U8AppMain/HttpHelper.cs Normal file
View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace U8AppMain
{
public static class HttpHelper
{
public static Task<string> Post(string url, string strBody)
{
strBody = strBody ?? "";
using (HttpClient client = new HttpClient())
{
var httpContent = new StringContent(strBody, Encoding.UTF8);
httpContent.Headers.ContentType.MediaType = "application/xml";
httpContent.Headers.ContentType.CharSet = "utf-8";
HttpResponseMessage response = client.PostAsync(url, httpContent).Result;
if (httpContent != null)
httpContent.Dispose();
return response.Content.ReadAsStringAsync();
}
}
}
}