Skip to content

ctx.readAsJson() error "Bad state: Stream has already been listened to." #26

@vvnab

Description

@vvnab

app.post("/todos", (HttpContext ctx){
ctx.readAsJson().then((x){
ctx.sendJson(x);
});
})

don`t work
trow error
"""
Bad state: Stream has already been listened to.

StackTrace:
#0 _StreamController._subscribe (dart:async/stream_controller.dart:601)
#1 _ControllerStream._createSubscription (dart:async/stream_controller.dart:790)
#2 _StreamImpl.listen (dart:async/stream_impl.dart:474)
#3 _ForwardingStreamSubscription._ForwardingStreamSubscription (dart:async/stream_pipe.dart:129)
#4 _ForwardingStream._createSubscription (dart:async/stream_pipe.dart:96)
#5 _ForwardingStream.listen (dart:async/stream_pipe.dart:88)
#6 _HttpIncoming.listen (dart:io/http_impl.dart:47)
#7 _HttpRequest.listen (dart:io/http_impl.dart:119)
#8 _SinkTransformerStreamSubscription._SinkTransformerStreamSubscription (dart:async/stream_transformers.dart:46)
#9 _BoundSinkStream.listen (dart:async/stream_transformers.dart:186)
#10 _HttpContext.readAsText (package:express/_http_context.dart:85:14)
#11 _HttpContext.readAsJson (package:express/_http_context.dart:95:17)
#12 main.

"""

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions