升级使用系统默认HttpMethods

This commit is contained in:
KevinWG
2018-02-01 21:13:07 +08:00
parent 6de165b4ef
commit a013bb849a
8 changed files with 18 additions and 50 deletions
Binary file not shown.
+3 -3
View File
@@ -10,9 +10,9 @@
<PackageProjectUrl>https://github.com/KevinWG/OSS.Http</PackageProjectUrl>
<RepositoryUrl>https://github.com/KevinWG/OSS.Http</RepositoryUrl>
<Version>1.2.7</Version>
<PackageReleaseNotes></PackageReleaseNotes>
<AssemblyVersion>1.2.7.2</AssemblyVersion>
<FileVersion>1.2.7.2</FileVersion>
<PackageReleaseNotes>使用系统HttpMethods</PackageReleaseNotes>
<AssemblyVersion>1.3.0.0</AssemblyVersion>
<FileVersion>1.3.0.0</FileVersion>
<PackageIconUrl>http://img1.static.osscoder.com/logo.jpg</PackageIconUrl>
<PackageLicenseUrl>https://github.com/KevinWG/OSS.Http/blob/master/LICENSE</PackageLicenseUrl>
</PropertyGroup>
+8 -10
View File
@@ -1,4 +1,3 @@
using System;
using System.Net.Http;
using System.Threading.Tasks;
using OSS.Common.Authrization;
@@ -11,15 +10,13 @@ namespace OSS.Http.Tests
{
public class UnitTest1
{
[Fact]
public async void TestRestCommonJson()
{
var req = new OsHttpRequest
{
AddressUrl = "http://localhost:62936",
HttpMethod = Mos.HttpMethod.GET
HttpMethod = HttpMethod.Get
};
MemberShiper.SetAppAuthrizeInfo(new AppAuthorizeInfo());
var res = await req.RestCommonJson<ResultMo>();
@@ -28,17 +25,18 @@ namespace OSS.Http.Tests
[Fact]
public void Test1()
public async void Test1()
{
GetTest1();
var res = await GetTest1();
Assert.True(res.IsSuccessStatusCode);
}
private static async Task<HttpResponseMessage> GetTest1()
{
var req = new OsHttpRequest
{
AddressUrl = "http://www.1.com",
HttpMethod = Mos.HttpMethod.GET
AddressUrl = "http://www.baidu.com",
HttpMethod = HttpMethod.Get
};
return await req.RestSend();
}
@@ -49,7 +47,7 @@ namespace OSS.Http.Tests
{
AddressUrl =
"https://api.weixin.qq.com/sns/oauth2/access_token?appid=wxaa9e6cb3f03afa97&secret=0fc0c6f735a90fda1df5fc840e010144&code=ssss&grant_type=authorization_code",
HttpMethod = Mos.HttpMethod.GET
HttpMethod = HttpMethod.Get
};
return await req.RestSend();
@@ -64,7 +62,7 @@ namespace OSS.Http.Tests
var req = new OsHttpRequest();
req.AddressUrl = "http://localhost:59489/";
req.HttpMethod = Mos.HttpMethod.POST;
req.HttpMethod = HttpMethod.Post;
// ÎļþÉÏ´«²âÊÔ
//var imageFile = new FileStream("E:\\111.png", FileMode.Open, FileAccess.Read);
+2 -2
View File
@@ -93,7 +93,7 @@ namespace OSS.Http.Extention
var reqMsg = new HttpRequestMessage
{
RequestUri = string.IsNullOrEmpty(request.AddressUrl) ? request.Uri : new Uri(request.AddressUrl),
Method = new System.Net.Http.HttpMethod(request.HttpMethod.ToString())
Method = request.HttpMethod
};
ConfigReqContent(reqMsg, request); // 配置内容
return reqMsg;
@@ -108,7 +108,7 @@ namespace OSS.Http.Extention
/// <returns></returns>
private static void ConfigReqContent(HttpRequestMessage reqMsg, OsHttpRequest req)
{
if (req.HttpMethod == Mos.HttpMethod.GET)
if (req.HttpMethod == HttpMethod.Get)
{
req.RequestSet?.Invoke(reqMsg);
return;
-30
View File
@@ -12,36 +12,6 @@
namespace OSS.Http.Mos
{
/// <summary>
///
/// </summary>
public enum HttpMethod
{
/// <summary>
/// Get
/// </summary>
GET = 0,
/// <summary>
/// post
/// </summary>
POST = 10,
/// <summary>
/// PUT
/// </summary>
PUT = 20,
/// <summary>
/// DELETE
/// </summary>
DELETE = 30,
HEAD=40,
OPTIONS=50,
TRACE=60
}
/// <summary>
/// 返回的状态
/// </summary>
+1 -1
View File
@@ -41,7 +41,7 @@ namespace OSS.Http.Mos
/// <summary>
/// 请求方式
/// </summary>
public HttpMethod HttpMethod { get; set; } = HttpMethod.GET;
public HttpMethod HttpMethod { get; set; } = HttpMethod.Get;
///// <summary>
///// 是否允许自动重定向
Binary file not shown.
+4 -4
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>2.3.8.2</Version>
<Version>2.5.0.0</Version>
<Authors>Kevin</Authors>
<Company>OSSCoder</Company>
<Product>OSS系列</Product>
@@ -10,9 +10,9 @@
<PackageProjectUrl>https://github.com/KevinWG/OSS.Http</PackageProjectUrl>
<RepositoryUrl>https://github.com/KevinWG/OSS.Http</RepositoryUrl>
<PackageIconUrl>http://img1.static.osscoder.com/logo.jpg</PackageIconUrl>
<AssemblyVersion>2.3.8.2</AssemblyVersion>
<FileVersion>2.3.8.2</FileVersion>
<PackageReleaseNotes></PackageReleaseNotes>
<AssemblyVersion>2.5.0.0</AssemblyVersion>
<FileVersion>2.5.0.0</FileVersion>
<PackageReleaseNotes>使用系统默认HttpMethods</PackageReleaseNotes>
<PackageLicenseUrl>https://github.com/KevinWG/OSS.Http/blob/master/LICENSE</PackageLicenseUrl>
<Copyright>OSSCoder</Copyright>
</PropertyGroup>