Franz.Common.Http
1.2.64
dotnet add package Franz.Common.Http --version 1.2.64
NuGet\Install-Package Franz.Common.Http -Version 1.2.64
<PackageReference Include="Franz.Common.Http" Version="1.2.64" />
paket add Franz.Common.Http --version 1.2.64
#r "nuget: Franz.Common.Http, 1.2.64"
// Install Franz.Common.Http as a Cake Addin #addin nuget:?package=Franz.Common.Http&version=1.2.64 // Install Franz.Common.Http as a Cake Tool #tool nuget:?package=Franz.Common.Http&version=1.2.64
Franz.Common.Http
A library within the Franz Framework designed to simplify HTTP-related operations, enhance exception handling, and streamline routing and serialization in ASP.NET Core applications. This package provides robust tools for managing errors, configuring application pipelines, and extending routing capabilities.
Features
- Error Management:
ErrorResponseProvider
andExceptionFilter
for centralized error handling.- Customizable error response strategies with
IErrorResponseProvider
.
- HTTP Context Extensions:
- Utilities for working with
HttpContext
and application configuration.
- Utilities for working with
- Routing Extensions:
- Parameter transformers for localized or custom routing:
FrenchControllerParameterTransformer
TranslateControllerParameterTransformer
.
- Parameter transformers for localized or custom routing:
- Service Registration:
ServiceCollectionExtensions
to streamline dependency injection for HTTP services.
- Compatibility:
- Seamlessly integrates with Franz.Common, Franz.Common.DependencyInjection, Franz.Common.Errors, and Franz.Common.Serialization.
Version Information
- Current Version: 1.2.64
- Part of the private Franz Framework ecosystem.
Dependencies
This package relies on:
- Microsoft.AspNetCore.Mvc.NewtonsoftJson (8.0.0): Enables advanced JSON serialization and deserialization.
- Franz.Common: Core utilities for the framework.
- Franz.Common.DependencyInjection: Simplifies dependency injection.
- Franz.Common.Errors: Standardized error handling.
- Franz.Common.Serialization: Custom serialization utilities.
Installation
From Private Azure Feed
Since this package is hosted privately, configure your NuGet client:
dotnet nuget add source "https://your-private-feed-url" \
--name "AzurePrivateFeed" \
--username "YourAzureUsername" \
--password "YourAzurePassword" \
--store-password-in-clear-text
Install the package:
dotnet add package Franz.Common.Http --Version 1.2.64
Usage
1. Centralized Error Handling
Register the ErrorResponseProvider
and ExceptionFilter
to handle errors consistently:
using Franz.Common.Http.Errors;
services.AddControllers(options =>
{
options.Filters.Add<ExceptionFilter>(); // Register the exception filter
});
services.AddSingleton<IErrorResponseProvider, ErrorResponseProvider>();
2. HTTP Context Extensions
Use HttpContextExtensions
to simplify access to HttpContext
data:
using Franz.Common.Http.Extensions;
var userAgent = context.GetHeaderValue("User-Agent");
3. Routing Parameter Transformers
Implement custom routing logic with parameter transformers:
using Franz.Common.Http.Routing;
public class CustomRouting : FrenchControllerParameterTransformer
{
public override string TransformOutbound(object value)
{
return base.TransformOutbound(value)?.ToUpperInvariant(); // Custom transformation logic
}
}
Register the transformer in your Startup.cs
:
services.AddRouting(options =>
{
options.ConstraintMap.Add("custom", typeof(CustomRouting));
});
4. Application Pipeline Configuration
Use ApplicationBuilderExtensions
to enhance the middleware pipeline:
using Franz.Common.Http.Extensions;
app.UseCustomErrorHandling(); // Custom extension for error handling
Integration with Franz Framework
The Franz.Common.Http package integrates seamlessly with:
- Franz.Common.Errors: For centralized error handling.
- Franz.Common.DependencyInjection: Simplifies DI setup for HTTP services.
- Franz.Common.Serialization: Enhances JSON serialization and deserialization.
- Franz.Common: Provides foundational utilities.
Ensure these dependencies are installed to fully leverage the library's capabilities.
Contributing
This package is part of a private framework. Contributions are limited to the internal development team. If you have access, follow these steps:
- Clone the repository. @ https://github.com/bestacio89/Franz.Common/
- Create a feature branch.
- Submit a pull request for review.
License
This library is licensed under the MIT License. See the LICENSE
file for more details.
Changelog
Version 1.2.64
- Upgrade version to .net 9
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net9.0
- Franz.Common (>= 1.2.64)
- Franz.Common.DependencyInjection (>= 1.2.64)
- Franz.Common.Errors (>= 1.2.64)
- Franz.Common.Serialization (>= 1.2.64)
- Microsoft.AspNetCore.Mvc.NewtonsoftJson (>= 9.0.1)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Franz.Common.Http:
Package | Downloads |
---|---|
Franz.Common.Http.MultiTenancy
Shared utility library for the Franz Framework. |
|
Franz.Common.Http.Identity
Shared utility library for the Franz Framework. |
|
Franz.Common.Http.Bootstrap
Shared utility library for the Franz Framework. |
GitHub repositories
This package is not used by any popular GitHub repositories.