Franz.Common.Http
1.2.62
dotnet add package Franz.Common.Http --version 1.2.62
NuGet\Install-Package Franz.Common.Http -Version 1.2.62
<PackageReference Include="Franz.Common.Http" Version="1.2.62" />
paket add Franz.Common.Http --version 1.2.62
#r "nuget: Franz.Common.Http, 1.2.62"
// Install Franz.Common.Http as a Cake Addin #addin nuget:?package=Franz.Common.Http&version=1.2.62 // Install Franz.Common.Http as a Cake Tool #tool nuget:?package=Franz.Common.Http&version=1.2.62
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.62
- 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.62
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.
- 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.62
- Added
ErrorResponseProvider
andExceptionFilter
for centralized error management. - Introduced routing extensions with
FrenchControllerParameterTransformer
andTranslateControllerParameterTransformer
. - Added
HttpContextExtensions
for simplified header and context management. - Full compatibility with Franz.Common, Franz.Common.Errors, and Franz.Common.Serialization.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. net9.0 was computed. 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. |
-
net8.0
- Franz.Common (>= 1.2.62)
- Franz.Common.DependencyInjection (>= 1.2.62)
- Franz.Common.Errors (>= 1.2.62)
- Franz.Common.Serialization (>= 1.2.62)
- Microsoft.AspNetCore.Mvc.NewtonsoftJson (>= 8.0.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Franz.Common.Http:
Package | Downloads |
---|---|
Franz.Common.Http.Bootstrap
Shared utility library for the Franz Framework. |
|
Franz.Common.Http.MultiTenancy
Shared utility library for the Franz Framework. |
|
Franz.Common.Http.Identity
Shared utility library for the Franz Framework. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.2.62 | 49 | 1/8/2025 |