public Returns When(Func <HttpRequestMessage, bool> expression) { var returns = new Returns(expression); handlers.Add(returns); return(returns); }
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 }); });
public static void ReturnFile(this Returns returns, HttpStatusCode statusCode, string filePath, string contentType = null) => returns.Return(() => {
public static void ReturnFile(this Returns returns, string filePath, string contentType = null) { ReturnFile(returns, HttpStatusCode.OK, filePath, contentType); }
public static void ReturnString(this Returns returns, string value, string contentType = "text/plain") { ReturnString(returns, HttpStatusCode.OK, value, contentType); }