public IStumpsServer CreateServer(int listeningPort, FallbackResponse fallbackResponse) { var server = new StumpsServer { ListeningPort = listeningPort, DefaultResponse = fallbackResponse }; return(server); }
public IStumpsServer CreateServer(int listeningPort, FallbackResponse fallbackResponse) { var server = new StumpsServer { ListeningPort = listeningPort, DefaultResponse = fallbackResponse }; return server; }
/// <summary> /// Initializes a new instance of the <see cref="FallbackResponseHandler"/> class. /// </summary> /// <param name="response">The default response.</param> /// <exception cref="ArgumentOutOfRangeException"><paramref name="response"/> is <c>null</c>.</exception> public FallbackResponseHandler(FallbackResponse response) { if (!Enum.IsDefined(typeof(FallbackResponse), response)) { throw new ArgumentOutOfRangeException(nameof(response)); } // Fallback to 503 Service Unavailable when undefined response = response == FallbackResponse.Undefined ? FallbackResponse.Http503ServiceUnavailable : response; _statusCode = (int)response; _statusCodeDescription = HttpStatusCodes.GetStatusDescription(_statusCode); _origin = response == FallbackResponse.Http404NotFound ? HttpResponseOrigin.NotFoundResponse : HttpResponseOrigin.ServiceUnavailable; }
/// <summary> /// Initializes a new instance of the <see cref="T:Stumps.FallbackResponseHandler"/> class. /// </summary> /// <param name="response">The default response.</param> /// <exception cref="System.ArgumentOutOfRangeException"><paramref name="response"/> is <c>null</c>.</exception> public FallbackResponseHandler(FallbackResponse response) { if (!Enum.IsDefined(typeof(FallbackResponse), response)) { throw new ArgumentOutOfRangeException("response"); } // Fallback to 503 Service Unavailable when undefined response = response == FallbackResponse.Undefined ? FallbackResponse.Http503ServiceUnavailable : response; _statusCode = (int)response; _statusCodeDescription = HttpStatusCodes.GetStatusDescription(_statusCode); _origin = response == FallbackResponse.Http404NotFound ? HttpResponseOrigin.NotFoundResponse : HttpResponseOrigin.ServiceUnavailable; }