Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions example/crimsonTest.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,23 @@ Future setTemplateData(HttpRequest req,HttpResponse res,var data) {
print(data);
StringBuffer sb = new StringBuffer();

req.inputStream.onData = () {
req.listen((data) {
print("setTemplateData onData");
sb.add(decodeUtf8(req.inputStream.read(req.inputStream.available())));
};

req.inputStream.onClosed = () {
req.transform(new Utf8Decoder()).listen((data) { sb.write(data); });
}, onDone: (() {
print("setTemplateData onClose");
print(sb.toString());

res.outputStream.writeString(sb.toString());
res.write(sb.toString());
c.complete(null);
};

req.inputStream.onError = (e) {
}), onError: ((e) {
print("setTemplateData onError");
print("error $e");
c.complete(null);
};
}));

return c.future;
}

//bool matcherFunction(HttpRequest req) {
// return req.path.endsWith("matcher");
//}
//}