takeOverResponse method

void takeOverResponse()

Say that this handler sends the response itself, on httpRequest.response. After this call Dox sends nothing more for the request: not the value the handler returns, not a change of a next middleware (like ETag), not the responseHandler of AppConfig, and not an error answer. Errors are still reported. Your code must end the response. One safety net: if the handler throws before it wrote the head or closed the response, Dox sends the normal error answer (or the route renderer's), so the client does not wait. Once the handler started writing, Dox sends nothing more.

Future<void> handle(DoxRequest req) async {
  req.takeOverResponse();
  HttpResponse res = req.httpRequest.response;
  res.write('done');
  await res.close();
}

Implementation

void takeOverResponse() => response_handler.takeOverResponse(httpRequest);