예제 #1
0
        public Returns When(Func <HttpRequestMessage, bool> expression)
        {
            var returns = new Returns(expression);

            handlers.Add(returns);
            return(returns);
        }
예제 #2
0
 public static void ReturnString(this Returns returns, HttpStatusCode statusCode, string value, string contentType = "text/plain")
 => returns.Return(() =>
 {
     var content = new StringContent(value);
     if (!string.IsNullOrEmpty(contentType))
     {
         content.Headers.ContentType = new MediaTypeHeaderValue(contentType);
     }
     return(new HttpResponseMessage(statusCode)
     {
         Content = content
     });
 });
예제 #3
0
 public static void ReturnFile(this Returns returns, HttpStatusCode statusCode, string filePath, string contentType = null)
 => returns.Return(() =>
 {
예제 #4
0
 public static void ReturnFile(this Returns returns, string filePath, string contentType = null)
 {
     ReturnFile(returns, HttpStatusCode.OK, filePath, contentType);
 }
예제 #5
0
 public static void ReturnString(this Returns returns, string value, string contentType = "text/plain")
 {
     ReturnString(returns, HttpStatusCode.OK, value, contentType);
 }