コード例 #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);
 }