mirror of
https://github.com/KevinWG/OSS.Tools.git
synced 2026-10-24 02:39:09 +08:00
31 lines
791 B
C#
31 lines
791 B
C#
using System;
|
|
using System.Net.Http;
|
|
using System.Net.Http.Headers;
|
|
using System.Threading.Tasks;
|
|
using OSS.Http.Mos;
|
|
|
|
namespace OSS.Http.Test
|
|
{
|
|
class Program
|
|
{
|
|
private static void Main(string[] args)
|
|
{
|
|
var req = new OsHttpRequest();
|
|
req.RequestSet = msg => msg.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
|
|
|
req.HttpMothed=HttpMothed.POST;
|
|
req.AddressUrl = "http://www.baidu.com";
|
|
req.CustomBody = "name=testname";
|
|
req.FormParameters.Add(new FormParameter("who","me"));
|
|
|
|
|
|
var result = req.RestSend();
|
|
result.Wait();
|
|
var content = result.Result.Content.ReadAsStringAsync();
|
|
content.Wait();
|
|
|
|
|
|
}
|
|
}
|
|
}
|