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
Code triggers assert in http code (dart:io) #13293
Comments
cc @lrhn. |
The error reported does not show up on ToT. Running the code yield unittest-suite-wait-for-done All 1 tests passed. Unhandled exception: Changing client.get to client.port to fix that causes the following error: unittest-suite-wait-for-done All 1 tests passed. Unhandled exception: I posted an updated test on stack-overflow which and asked for the Dart version used. Added NeedsInfo label. |
Added AssumedStale label. |
Reported by Otskimanot Sqilal on stack-overflow:
The following code triggers an assert in checked mode:
Breaking on exception: 'dart:async/stream_impl.dart': Failed assertion: line 149 pos 12: '! _isClosed' is not true.
import 'dart:io';
import 'package:unittest/unittest.dart';
void main() {
test('check if sent data equals expected data', () {
HttpServer.bind('127.0.0.1', 8080)
.then(expectAsync1((HttpServer server) {
server.listen((HttpRequest request) {
expect(request.runtimeType.toString(), equals('_HttpRequest'));
request.fold(new BytesBuilder(), (prev, next) {
prev.addAll(next);
return prev;
})
.then(expectAsync1((BytesBuilder bb) {
var bytes = bb.takeBytes(),
helloString = new String.fromCharCodes(bytes);
expect(helloString, equals('hello'));
request.response.write(helloString);
request.response.close();
server.close();
}));
});
}));
HttpClient client = new HttpClient();
client.get('127.0.0.1', 8080, '/')
.then((HttpClientRequest request) {
request.add('hello'.codeUnits);
return request.close();
});
});
}
The text was updated successfully, but these errors were encountered: