Skip to content

Latest commit

 

History

History
239 lines (207 loc) · 7.26 KB

File metadata and controls

239 lines (207 loc) · 7.26 KB

Microsoft.AspNetCore.Http


AnonymousAccessExtensions

Extension methods for configuring anonymous access in development environments.

public static class AnonymousAccessExtensions

Static Methods

AddAnonymousAccessForDevelopment

IServiceCollection AddAnonymousAccessForDevelopment(this IServiceCollection services)

Summary: Registers an authorization handler that allows anonymous access to all endpoints in Development mode.

Parameters:
     services  -  The service collection.

Returns: The service collection for method chaining.


FormFileExtensions

Extension methods for Microsoft.AspNetCore.Http.IFormFile to simplify file handling in ASP.NET Core.

public static class FormFileExtensions

Static Methods

GetBytes

Task<byte[]> GetBytes(this IFormFile formFile)

Summary: Converts an uploaded form file to a byte array.

Parameters:
     formFile  -  The form file to convert.

Returns: A task representing the asynchronous operation, containing the file contents as a byte array.


HeaderDictionaryExtensions

Extension methods for Microsoft.AspNetCore.Http.IHeaderDictionary to manage request correlation and identity headers.

public static class HeaderDictionaryExtensions

Static Methods

AddCorrelationId

string AddCorrelationId(this IHeaderDictionary headers, string correlationId)

Summary: Adds a correlation ID to the header dictionary.

Parameters:
     headers  -  The headers.
     correlationId  -  The correlation ID to add.

Returns: The correlation ID that was added.

GetCallingOnBehalfOfIdentity

string GetCallingOnBehalfOfIdentity(this IHeaderDictionary headers)

Summary: Gets the on-behalf-of identity from the x-on-behalf-of header.

Parameters:
     headers  -  The headers.

Returns: The on-behalf-of identity if present; otherwise, null.

Remarks: This header is used in scenarios where a service acts on behalf of a user or another service.

GetOrAddCorrelationId

string GetOrAddCorrelationId(this IHeaderDictionary headers)

Summary: Gets the correlation ID from the header, or generates and adds a new one if not found.

Parameters:
     headers  -  The headers.

Returns: The correlation ID for the request.

GetOrAddRequestId

string GetOrAddRequestId(this IHeaderDictionary headers)

Summary: Gets the request ID from the header, or generates and adds a new one if not found.

Parameters:
     headers  -  The headers.

Returns: The request ID for the request.


HttpContextExExtensions

Extension methods for Microsoft.AspNetCore.Http.HttpContext to retrieve request correlation identifiers.

public static class HttpContextExExtensions

Static Methods

GetCorrelationId

string GetCorrelationId(this HttpContext context)

Summary: Gets the correlation ID from the request headers.

Parameters:
     context  -  The HTTP context.

Returns: The correlation ID if present in the request headers; otherwise, null.

GetRequestId

string GetRequestId(this HttpContext context)

Summary: Gets the request ID from the request headers.

Parameters:
     context  -  The HTTP context.

Returns: The request ID if present in the request headers; otherwise, null.


HttpRequestExExtensions

Extension methods for Microsoft.AspNetCore.Http.HttpRequest to retrieve raw request body content.

public static class HttpRequestExExtensions

Static Methods

GetRawBodyBytesAsync

Task<byte[]> GetRawBodyBytesAsync(this HttpRequest request)

Summary: Retrieves the raw body as a byte array from the Request.Body stream.

Parameters:
     request  -  The HTTP request instance.

Returns: A task representing the asynchronous operation, containing the request body as a byte array.

GetRawBodyStringAsync

Task<string> GetRawBodyStringAsync(this HttpRequest request, Encoding encoding = null)

Summary: Retrieves the raw body as a string from the Request.Body stream.

Parameters:
     request  -  The HTTP request instance.
     encoding  -  The encoding to use for reading the stream. Defaults to UTF8 if not specified.

Returns: A task representing the asynchronous operation, containing the request body as a string.


WellKnownHttpHeaders

Defines well-known HTTP header names used throughout the REST API framework.

Remarks: These header names follow common conventions for distributed tracing, pagination, conditional requests, and identity propagation in microservice architectures.

public static class WellKnownHttpHeaders

Static Fields

CallingIdentity

string CallingIdentity

Summary: The calling identity header name for tracking the authenticated user identity.

Continuation

string Continuation

Summary: The continuation token header name for cursor-based pagination.

CorrelationId

string CorrelationId

Summary: The correlation ID header name for distributed tracing across service boundaries.

ETag

string ETag

Summary: The ETag header name for entity versioning and caching.

Filename

string Filename

Summary: The filename header name for file download operations.

IfMatch

string IfMatch

Summary: The If-Match header name for conditional requests based on ETag.

IfNoneMatch

string IfNoneMatch

Summary: The If-None-Match header name for conditional requests based on ETag.

MaxItemCount

string MaxItemCount

Summary: The maximum item count header name for pagination requests.

OnBehalfOf

string OnBehalfOf

Summary: The on-behalf-of header name for identity delegation in service-to-service calls.

RequestId

string RequestId

Summary: The request ID header name for tracking individual requests.

ValueSeparator

string ValueSeparator

Summary: The standard separator for multiple header values.


Generated by MarkdownCodeDoc version 1.2