anchor.diff:  
     int slash = path.indexOf('/');
     if (slash == -1) {
  -    return packageShowHandler(request, path);
  +    bool responseAsJson = request.url.queryParameters['format'] == 'json';
  +    if (path.endsWith('.json')) {
  +      responseAsJson = true;
  +      path = path.substring(0, path.length - '.json'.length);
  +    }
  +    if (responseAsJson) {
  +      return packageShowHandlerJson(request, path);
  +    } else {
  +      return packageShowHandlerHtml(request, path);
  +    }
     }
   
     var package = path.substring(0, slash);
  
positive.code: 
    var versions = await
        db.query(PackageVersion, ancestorKey: package.key).run().toList();
    _sortVersionsDesc(versions);
    var first10Versions = versions.take(10).toList();
    return _htmlResponse(templateService.renderPkgShowPage(
        package, first10Versions, first10Versions.last, versions.length));
  }
  
  /// Handles requests for /packages/<package>/versions/<version>
  packageVersionsHandler(shelf.Request request, String packageName) async {
  
negative.code:       templateService.renderPkgIndexPage(pagePackages, versions, links));
  }
  
  
  /// Handles requests for /packages/...  - multiplexes to HTML/JSON handlers
  ///
  /// Handles the following URLs:
  ///   - /packages/<package>
  