Context constructor

Context(
  1. HttpRequest _request
)

Create base Context object takes HttpRequest

Implementation

Context(this._request) {
  void onHijack(void Function(StreamChannel<List<int>>) callback) {
    _request.response
        .detachSocket(writeHeaders: false)
        .then((socket) => callback(StreamChannel(socket, socket)));
  }

  _onHijack = _OnHijack(onHijack);
  // set default response content-type
  contentType ??= ContentType.html;
  // empty body
  body = null;
}