Ybd.AbpLite.UnifiedResponse.Client
2.0.0
dotnet add package Ybd.AbpLite.UnifiedResponse.Client --version 2.0.0
NuGet\Install-Package Ybd.AbpLite.UnifiedResponse.Client -Version 2.0.0
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="Ybd.AbpLite.UnifiedResponse.Client" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ybd.AbpLite.UnifiedResponse.Client" Version="2.0.0" />
<PackageReference Include="Ybd.AbpLite.UnifiedResponse.Client" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Ybd.AbpLite.UnifiedResponse.Client --version 2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Ybd.AbpLite.UnifiedResponse.Client, 2.0.0"
#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.
#:package Ybd.AbpLite.UnifiedResponse.Client@2.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Ybd.AbpLite.UnifiedResponse.Client&version=2.0.0
#tool nuget:?package=Ybd.AbpLite.UnifiedResponse.Client&version=2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Ybd.AbpLite.UnifiedResponse.Client
配合 Ybd.AbpLite.UnifiedResponse 使用的 ABP 客户端包。
服务端默认返回统一信封:
{ "success": true, "data": { "id": "...", "name": "DDD" } }
ABP 动态客户端的接口契约是裸 DTO(Task<BookDto>),它不会自动解信封。本包给所有 ABP 动态代理请求加:
X-Unified-Response: native
服务端看到这个头后返回裸 DTO 和 ABP 原生错误,动态代理就能按契约正常反序列化。
使用
[DependsOn(typeof(AbpLiteUnifiedResponseClientModule))]
public class MyClientModule : AbpModule
{
}
如果只需要给某个自定义 HttpClient 加头:
services.AddHttpClient("my-client")
.AddAbpLiteNativeResponseHeader();
说明
- 只对 ABP 动态代理 / 显式使用本包 Handler 的客户端生效;
- 服务端必须开启
UnifiedResponse:AllowNativeOverride(默认开启); - 服务端
Mode=Native时本来就不包装,这个头不会产生副作用; - 不使用 ABP 动态代理、而是手写 axios/fetch 的前端,不需要引用本包。
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Microsoft.Extensions.Configuration.Binder (>= 10.0.11)
- Microsoft.Extensions.Configuration.CommandLine (>= 10.0.11)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 10.0.11)
- Microsoft.Extensions.Configuration.Json (>= 10.0.11)
- Volo.Abp.ExceptionHandling (>= 10.7.0)
- Volo.Abp.Http (>= 10.7.0)
- Volo.Abp.Http.Client (>= 10.7.0)
- Volo.Abp.Localization (>= 10.7.0)
- Volo.Abp.Security (>= 10.7.0)
- Ybd.AbpLite.UnifiedResponse.Abstractions (>= 1.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.