Create own response - kotC9/VueNancy GitHub Wiki
first, all Responses in NancyFx used as Extensions: https://github.com/NancyFx/Nancy/blob/master/src/Nancy/FormatterExtensions.cs
Create static class in /Extensions:
public static class FormatterExtensions
{
public static Response AsMyResponse(this IResponseFormatter _, string response)
{
return new MyResponse(response);
}
}
create class MyResponse:
public class MyResponse : Response
{
public MyResponse(string response)
{
ContentType = "text";
//string to Action<Stream>
Contents = GetStringContents(response);
//end
}
}
end.
u can use it in your module:
Get("get-myresponse", args => Response.AsMyResponse("example message"));