Nancy: Not possible for Response implementations to write async content.

Created on 3 Oct 2015  路  5Comments  路  Source: NancyFx/Nancy

Proposed solution: In addition to Action<Stream> Contents there could be Action<Task<Stream>> AsyncContents which takes presidence when non-null.

An example of code that suffers from the non-presence of this feature: https://github.com/NancyFx/Nancy/blob/master/src/Nancy/Responses/StreamResponse.cs

StreamResponse will block the thread during read and write IO.

Most helpful comment

Any news on this?.
Would be nice if Process on IResponseProcessor could return a Task instead of Response.
Or that Response.Contents Can take Func instead of Action

All 5 comments

:+1: This will be done as part of the 2.0 overhaul.

We're planning on dropping 4.0 support and go full-blown async/await all over the place.
The Contents property will most likely be a Func<Stream, Task> :smile:

I'll leave this open for tracking :watch:

Waiting for #2105 to be merged first.

Any news on this?.
Would be nice if Process on IResponseProcessor could return a Task instead of Response.
Or that Response.Contents Can take Func instead of Action

Hi, was this implemented with v2.0.0 ? I can't seem to find the method.

Any update?

Was this page helpful?
0 / 5 - 0 ratings