scheme method

  1. @override
String? scheme(
  1. HttpRequest req
)
override

https or http for a port that bind opened in this isolate, from the local port of the connection. null for a request of another server (eg. a CustomServer).

Implementation

@override
String? scheme(HttpRequest req) {
  // a subclass (eg. a CustomServer) binds its own servers
  if (_ports.isEmpty || runtimeType != IoServerAdapter) return null;
  int? port = req.connectionInfo?.localPort;
  bool? tls = port == null ? null : _ports[port];
  if (tls == null) return null;
  return tls ? 'https' : 'http';
}