Skip to main content

RA.Utilities.Api.Middlewares

NuGet version NuGet Downloads Codecov Publish NuGet GitHub license

Deprecated Package

This package is deprecated and has been moved to RA.Utilities.Api.

All middleware types are now available in the RA.Utilities.Api package with expanded features — including multi-header enforcement, log-scope enrichment, and header filtering. See the RA.Utilities.Api middlewares documentation for the current API and migration instructions.

RA.Utilities.Api.Middlewares provides a collection of useful ASP.NET Core middlewares designed to improve diagnostics and enforce API best practices. This package includes middlewares for efficient HTTP request/response logging and for ensuring the presence of default required headers.

🎯 Purpose​

This package aims to solve common cross-cutting concerns in API development:

  1. HTTP Request/Response Logging: Provides a highly performant middleware to log detailed information about incoming requests and their corresponding responses. It uses Microsoft.IO.RecyclableMemoryStream to minimize memory allocations, making it suitable for high-throughput applications.
  2. Header Enforcement: Includes a middleware to validate the presence of essential headers, such as X-Request-Id, to ensure traceability and consistency across your services.

🛠️ Installation​

You can install the package via the .NET CLI:

dotnet add package RA.Utilities.Api.Middlewares

Or through the NuGet Package Manager console:

Install-Package RA.Utilities.Api.Middlewares

Or through the NuGet Package Manager in Visual Studio.

🔗 Dependencies​

The middleware types previously documented here are now part of RA.Utilities.Api — see the Middlewares and Extensions sections for the current API.