endResponse function

void endResponse(
  1. HttpResponse res
)

Sends res when nothing waits for it. The native server sends with no Future: the Future of close() would only keep the request alive until its microtask runs, and under load the heap grows. A dart:io response is closed as before. Errors go to res.done, as with an unused close().

Implementation

void endResponse(HttpResponse res) {
  if (res is NativeResponse) {
    res.end();
  } else {
    res.close();
  }
}