5

The problem is simple: I need add batch requests support for NancyFX.

Recently I found issue on github about Nancy batching support. The issue was created a long time ago, but there is still no any working solution. And this issue - is the ONLY mention about Nancy batching I found!

With code from that gist and that pull request we can parse batch request to parts, and create Nancy Request objects. And we can even send them to NancyEngine.

var contentType = new ContentType(Request.Headers.ContentType);
var multipartRequest = new HttpMultipart(Request.Body, contentType.Boundary);

foreach (var boundry in multipartRequest.GetBoundaries())
{
    var subRequest = boundry.Value.ReadAsRequest(); // our extension

    nancyEngine.HandleRequest(subRequest,
        context =>
        {
            // success
        },
        exception =>
        {
            // error
        });
}

But I had troubles with creating batch response from multiple Nancy responses. I need something like MultipartContent class from ASP WebApi, but for Nancy.

Does anyone know any working Nancy batching solution? Or can help with creating batch response from multiple Nancy responses?

Harry Burns
  • 770
  • 5
  • 19

0 Answers0