Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using futures in routes causes issues when doing async write to response stream #16

Open
jakobdamjensen opened this issue Feb 20, 2013 · 2 comments

Comments

@jakobdamjensen
Copy link

Long story short. I have routes that does some database lookup with an API based on Futures.

Then problem is, that the lines 102-107 in ehttp.dart makes it impossible to do this since the outputStream is being closed as soon as the inputstream is.

synthReq.inputStream.onClosed = () {
        // Close response stream if needed.
        if (!synthRes.outputStream.closed) {
          synthRes.outputStream.close();
        }
      };

Perhaps I'm doing something wrong.

Removing these lines does make it work but it has a sideeffect in my middlewares.

@jakobdamjensen
Copy link
Author

actually the problem is not only in routes but also in middlewares. the fix in the issue does not work for middlewares...

@maiah
Copy link
Owner

maiah commented Feb 21, 2013

Thanks for this feedback. I haven't worked for a while in this library and I wish to update this soon as I get time. Pull requests are welcome. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants