handleRequest method

Future<bool> handleRequest(
  1. RequestContext req,
  2. ResponseContext res
)

Responds to incoming HTTP requests.

Implementation

Future<bool> handleRequest(RequestContext req, ResponseContext res) {
  if (req.method != 'GET' && req.method != 'HEAD') {
    return Future<bool>.value(true);
  }
  var path = req.uri!.path.replaceAll(_straySlashes, '');

  if (_prefix.isNotEmpty == true && !path.startsWith(_prefix)) {
    return Future<bool>.value(true);
  }

  return servePath(path, req, res);
}