Skip to content

Instantly share code, notes, and snippets.

@andrew-m
Created January 5, 2015 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrew-m/1342e30851f302f97b5b to your computer and use it in GitHub Desktop.
Save andrew-m/1342e30851f302f97b5b to your computer and use it in GitHub Desktop.
OwinNancyMaxJsonLengthBugExample
using System;
using Nancy;
using Owin;
using Microsoft.Owin.Hosting;
namespace NancyApplication1
{
public class Program
{
static void Main(string[] args)
{
var uri = "http://+:8080";
using (WebApp.Start(uri, app => app.UseNancy()))
{
Console.WriteLine("Running on {0}", uri);
Console.WriteLine("Press enter to exit");
Console.ReadLine();
}
}
}
public class IndexModule : NancyModule
{
public IndexModule()
{
Get["/ok"] = Ok;
Get["/failSilently"] = FailSilently;
}
private dynamic Ok(dynamic arg)
{
return Response.AsJson(new String('X', 100000));
}
private dynamic FailSilently(dynamic arg)
{
//Would expect Http 500, but get connection reset.
return Response.AsJson(new String('X', 200000));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment