Skip to content

Latest commit

 

History

History
99 lines (92 loc) · 3.85 KB

File metadata and controls

99 lines (92 loc) · 3.85 KB

System.Net


HttpStatusCodeExtensions

Provides extension methods for the System.Net.HttpStatusCode enumeration.

public static class HttpStatusCodeExtensions

Static Methods

IsClientError

bool IsClientError(this HttpStatusCode httpStatusCode)

Summary: Determines whether the HTTP status code indicates a client error (4xx range).

Parameters:
     httpStatusCode  -  The HTTP status code to check.

Returns: if the status code is between 400-499; otherwise, .

IsClientOrServerError

bool IsClientOrServerError(this HttpStatusCode httpStatusCode)

Summary: Determines whether the HTTP status code indicates either a client error or a server error (4xx or 5xx range).

Parameters:
     httpStatusCode  -  The HTTP status code to check.

Returns: if the status code is between 400-599; otherwise, .

IsInformational

bool IsInformational(this HttpStatusCode httpStatusCode)

Summary: Determines whether the HTTP status code is informational (1xx range).

Parameters:
     httpStatusCode  -  The HTTP status code to check.

Returns: if the status code is between 100-199; otherwise, .

IsRedirect

bool IsRedirect(this HttpStatusCode httpStatusCode)

Summary: Determines whether the HTTP status code indicates a redirect (3xx range).

Parameters:
     httpStatusCode  -  The HTTP status code to check.

Returns: if the status code is between 300-399; otherwise, .

IsServerError

bool IsServerError(this HttpStatusCode httpStatusCode)

Summary: Determines whether the HTTP status code indicates a server error (5xx range).

Parameters:
     httpStatusCode  -  The HTTP status code to check.

Returns: if the status code is between 500-599; otherwise, .

IsSuccessful

bool IsSuccessful(this HttpStatusCode httpStatusCode)

Summary: Determines whether the HTTP status code indicates success (2xx range).

Parameters:
     httpStatusCode  -  The HTTP status code to check.

Returns: if the status code is between 200-299; otherwise, .

ToNormalizedString

string ToNormalizedString(this HttpStatusCode httpStatusCode)

Summary: Converts the HTTP status code to a normalized string representation.

Parameters:
     httpStatusCode  -  The HTTP status code to convert.

Returns: A normalized string representation of the HTTP status code (e.g., "Ok" instead of "OK").

ToStatusCodesConstant

string ToStatusCodesConstant(this HttpStatusCode httpStatusCode)

Summary: Converts the HTTP status code to a status codes constant name format.

Parameters:
     httpStatusCode  -  The HTTP status code to convert.

Returns: A string in the format "Status{code}{name}" (e.g., "Status200OK").


Generated by MarkdownCodeDoc version 1.2