Skip to content

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

@jakobdamjensen

Description

@jakobdamjensen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions