src/HttpServer/Utils.cs
/// <summary>
/// Map an HTTP status code to reason string
/// </summary>
/// <param name="statusCode">HTTP status code</param>
/// <returns>Reason mapped</returns>
Map an HTTP status code to reason string
Map an HTTP status code to reason string
public static string MapStatusCodeToReason(HttpStatusCode statusCode)
        {
            switch (statusCode)
            {
                case HttpStatusCode.OK:
                    return "OK";
                case HttpStatusCode.Found:
                    return "Found";
                case HttpStatusCode.BadRequest:
                    return "Bad request";
                case HttpStatusCode.Unauthorized:
                    return "Unauthorized";
                case HttpStatusCode.Forbidden:
                    return "Forbidden";
                case HttpStatusCode.NotFound:
                    return "Not found";
                case HttpStatusCode.MethodNotAllowed:
                    return "Method not allowed";
                case HttpStatusCode.InternalServerError:
                    return "Internal server error";
                case HttpStatusCode.ServiceUnavailable:
                    return "Service unavailable";
            }
            return null;
        }
public static string MapStatusCodeToReason ( HttpStatusCode statusCode ) { switch ( statusCode ) { case HttpStatusCode . OK : return " " ; case HttpStatusCode . Found : return " " ; case HttpStatusCode . BadRequest : return " " ; case HttpStatusCode . Unauthorized : return " " ; case HttpStatusCode . Forbidden : return " " ; case HttpStatusCode . NotFound : return " " ; case HttpStatusCode . MethodNotAllowed : return " " ; case HttpStatusCode . InternalServerError : return " " ; case HttpStatusCode . ServiceUnavailable : return " " ; } return null ; }
Map an HTTP status code to reason string
Map an HTTP status code to reason string
None
statusCode
HttpStatusCode
HTTP status code
HTTP status code