Token.HttpClientHelper
1.2.1
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Token.HttpClientHelper --version 1.2.1
NuGet\Install-Package Token.HttpClientHelper -Version 1.2.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Token.HttpClientHelper" Version="1.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Token.HttpClientHelper --version 1.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Token.HttpClientHelper, 1.2.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Token.HttpClientHelper as a Cake Addin #addin nuget:?package=Token.HttpClientHelper&version=1.2.1 // Install Token.HttpClientHelper as a Cake Tool #tool nuget:?package=Token.HttpClientHelper&version=1.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
工具合集
介绍
为了简化一些代码封装了适合小项目使用的工具包
http工具
- HttpClientHelper
//先注入工具 工具使用的是单例生命周期
service.AddTokenHttpHelperInject("http://localhost:5104/");
...
//使用工具前先注入工具
private readonly TokenHttp _tokenHttp;
public DemoService(TokenHttp tokenHttp){
_tokenHttp=tokenHttp;
}
...
//使用工具
var result= _tokenHttp.GetAsync("/api/demo");
自动注入工具
2.Inject
// 你需要注入的项目的程序集,一个项目只需要一个即可
services.AddAutoInject(typeof(DemoModule));
...
//使用工具 继承ITransientTag 将使用Transient生命周期
// IScopedTag ITransientTag ISingletonTag 三种生命周期标志,继承不同接口生命周期也不同
public class DemoService:ITransientTag
{
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- Microsoft.AspNet.WebApi.Client (>= 5.2.8)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
- System.Net.Http.Json (>= 6.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
增加post接口返回stream,修改统一使用的接口返回的参数