RA.Utilities.Api.Middlewares
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:
- HTTP Request/Response Logging: Provides a highly performant middleware to log detailed information about incoming requests and their corresponding responses.
It uses
Microsoft.IO.RecyclableMemoryStreamto minimize memory allocations, making it suitable for high-throughput applications. - 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
RA.Utilities.Core.ConstantsRA.Utilities.Logging.SharedRA.Utilities.Api.ResultsMicrosoft.AspNetCore.AppMicrosoft.IO.RecyclableMemoryStream
📄️ DefaultHeadersMiddleware
The DefaultHeadersMiddleware is a piece of ASP.NET Core middleware designed to enforce API best practices by ensuring that every incoming request includes a specific, mandatory header: X-Request-Id.
📄️ HttpLoggingMiddleware
The HttpLoggingMiddleware is a high-performance ASP.NET Core middleware designed to provide comprehensive logging for HTTP requests and responses.
🗃️ Extensions Methods
2 items