Franz.Common.Http.Headers 1.2.62

dotnet add package Franz.Common.Http.Headers --version 1.2.62                
NuGet\Install-Package Franz.Common.Http.Headers -Version 1.2.62                
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="Franz.Common.Http.Headers" Version="1.2.62" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Franz.Common.Http.Headers --version 1.2.62                
#r "nuget: Franz.Common.Http.Headers, 1.2.62"                
#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 Franz.Common.Http.Headers as a Cake Addin
#addin nuget:?package=Franz.Common.Http.Headers&version=1.2.62

// Install Franz.Common.Http.Headers as a Cake Tool
#tool nuget:?package=Franz.Common.Http.Headers&version=1.2.62                

Franz.Common.Http.Headers

A library within the Franz Framework designed to streamline the management, validation, and processing of HTTP headers in ASP.NET Core applications. This package provides custom model binders, attributes, and utilities for working with headers, ensuring consistency and efficiency across applications.


Features

  • Header Validation:
    • HeaderRequiredAttribute for enforcing required headers on API actions.
    • HeaderRequiredActionConstraint for conditional routing based on headers.
  • Custom Model Binding:
    • ComplexModelBinder and HeaderComplexModelBinderProvider for advanced header parsing and mapping.
  • HTTP Context Utilities:
    • HeaderContextAccessor for simplified access to HTTP header data.
  • Dependency Injection:
    • ServiceCollectionExtensions for easily integrating header-related services.

Version Information

  • Current Version: 1.2.62
  • Part of the private Franz Framework ecosystem.

Dependencies

This package relies on:

  • Microsoft.AspNetCore.Mvc.Core (2.2.5): Provides core MVC functionality for headers.
  • Newtonsoft.Json (13.0.3): Advanced JSON serialization for complex header handling.
  • Franz.Common.Headers: Core header utilities.
  • Franz.Common.Serialization: Serialization utilities for advanced header operations.

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.Headers --version 1.2.62

Usage

1. Enforce Required Headers

Use HeaderRequiredAttribute to enforce the presence of specific headers:

using Franz.Common.Http.Headers.Extensions;

[HttpGet]
[HeaderRequired("X-Custom-Header")]
public IActionResult Get()
{
    return Ok("Header is present");
}

2. Advanced Header Parsing

Leverage ComplexModelBinder to parse and bind headers to complex objects:

using Franz.Common.Http.Headers.Extensions;

public class CustomHeaderModel
{
    public string Key { get; set; }
    public string Value { get; set; }
}

[HttpPost]
public IActionResult Post([ModelBinder(typeof(ComplexModelBinder))] CustomHeaderModel headerModel)
{
    return Ok(headerModel);
}

3. HTTP Context Access

Simplify access to header data using HeaderContextAccessor:

using Franz.Common.Http.Headers.Extensions;

var customHeader = contextAccessor.GetHeaderValue("X-Custom-Header");

4. Register Header Utilities

Use ServiceCollectionExtensions to register all header-related utilities:

using Franz.Common.Http.Headers.Extensions;

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddHeaderUtilities(); // Registers header-related services and utilities
    }
}

Integration with Franz Framework

The Franz.Common.Http.Headers package integrates seamlessly with:

  • Franz.Common.Headers: Core header utilities and extensions.
  • Franz.Common.Serialization: Enhances serialization for complex header processing.

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:

  1. Clone the repository.
  2. Create a feature branch.
  3. 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 HeaderRequiredAttribute for enforcing required headers.
  • Introduced ComplexModelBinder for advanced header parsing.
  • Added HeaderContextAccessor for simplified HTTP context access.
  • Full compatibility with Franz.Common.Headers and Franz.Common.Serialization.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Franz.Common.Http.Headers:

Package Downloads
Franz.Common.Http.Bootstrap

Shared utility library for the Franz Framework.

Franz.Common.Http.MultiTenancy

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 60 1/8/2025