![]() |
VOOZH | about |
dotnet add package Vulttech_HttpClient --version 1.1.5
NuGet\Install-Package Vulttech_HttpClient -Version 1.1.5
<PackageReference Include="Vulttech_HttpClient" Version="1.1.5" />
<PackageVersion Include="Vulttech_HttpClient" Version="1.1.5" />Directory.Packages.props
<PackageReference Include="Vulttech_HttpClient" />Project file
paket add Vulttech_HttpClient --version 1.1.5
#r "nuget: Vulttech_HttpClient, 1.1.5"
#:package Vulttech_HttpClient@1.1.5
#addin nuget:?package=Vulttech_HttpClient&version=1.1.5Install as a Cake Addin
#tool nuget:?package=Vulttech_HttpClient&version=1.1.5Install as a Cake Tool
HttpClient Customizado para los llamados a los endpoint
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 1.1.5 | 355 | 10/8/2025 | 1.1.5 is deprecated because it has critical bugs. |
| 1.0.9.1 | 324 | 11/12/2025 | |
| 1.0.8.1 | 318 | 11/12/2025 | |
| 1.0.7.1 | 235 | 10/16/2025 | |
| 1.0.7 | 217 | 10/9/2025 | |
| 1.0.6 | 245 | 10/9/2025 | |
| 1.0.5 | 481 | 6/25/2025 | |
| 1.0.4 | 223 | 6/19/2025 | |
| 1.0.3 | 226 | 6/19/2025 | |
| 1.0.2 | 235 | 6/19/2025 | |
| 1.0.1 | 226 | 6/18/2025 | |
| 1.0.0 | 215 | 6/17/2025 |
🌐 Vulttech_HttpClient
Cliente HTTP reutilizable para microservicios basado en HttpClientFactory. Facilita llamados HTTP con soporte para autenticación, serialización automática, logging y configuración por appsettings.
📦 Instalación
bash
dotnet add package Vulttech.HttpClient --version 1.0.5
🚀 Características
Soporte para GET, POST, PUT, PATCH, HEAD
Autenticación por Bearer, Basic, o ninguna (None)
Lectura automática de endpoints desde appsettings.json
Compatible con IHttpClientFactory
Factory personalizado HttpClientVulttechFactory
Inyección de dependencias lista para usar
Manejo de errores centralizado
Logging integrado
🔧 Configuración
1. En appsettings.json
json ejemplo:
"ServiceEndpoints": {
"Usuarios": "https://api.midominio.com/usuarios",
"Turnos": "https://api.midominio.com/turnos",
"Authentication": {
"User": "UsuarioBasic",
"Password": "123456",
"ApiUser": "UsuarioApi",
"ApiKey": "123456789"
}
},
"JwtSeccion": {
"Key": "clave-qweqwewqeqweqweqweqwe",
"Issuer": "Issuer",
"Audience": "Audience",
"ExpiresInMinutes": 1000
},
La key Authentication puede estar dentro de los endpoint o fuera de el independientemente
2. En Program.cs
builder.Services.AddVulttechHttpClients(builder.Configuration, "ServiceEndpoints", "Authentication", "JwtSeccion");
Esto agrega automáticamente un HttpClient nombrado para cada microservicio.
🧑💻 Cómo usar
1. Inyectar la Factory
Csharp
public class UsuarioClient
{
private readonly HttpClientVulttech _httpClienteVult;
public UsuarioClient(IHttpClientVulttechFactory factory)
{
_httpClienteVult = factory.CreateClientVult("Usuarios")
}
🔐 Autenticación
El método GetAsync, PostAsync, etc., aceptan un parámetro AuthenticationType:
csharp
public enum AuthenticationType
{
None,
Bearer,
Basic,
ApiKey
}
Ejemplo de POST con autenticación Bearer:
csharp
var usuario = new Usuario { Nombre = "Juan" };
Usuario usuarioResponse = await httpClienteVult.PostAsync<Usuario>("api/usuarios", usuario, AuthenticationType.Bearer);
🔍 Logging
Incluye logs de entrada/salida si inyectás ILogger<IHttpClientVulttech>.
📤 Métodos disponibles
csharp
Task<T?> GetAsync<T>(string requestUri, AuthenticationType auth = None);
Task<TResponse?> PostAsync<TResponse>(string requestUri, object body, AuthenticationType auth = None);
Task<TResponse?> PutAsync<TResponse>(string requestUri, object body, AuthenticationType auth = None);
Task<TResponse?> PatchAsync<TResponse>(string requestUri, object body, AuthenticationType auth = None);
Task<HttpResponseMessage> HeadAsync(string requestUri, AuthenticationType auth = None);
🤝 Requisitos
.NET 6 o superior
Configuración de ServiceEndpoints en tu aplicación
Token disponible en HttpContext si usás Bearer