link method

  1. @override
Future<Link> link()
override

Returns the link from which the resource was retrieved.

It might be modified by the Resource to include additional metadata, e.g. the Content-Type HTTP header in Link.type.

Implementation

@override
Future<Link> link() async {
  int? compressedLength =
      (await entry()).map((it) => it.compressedLength).getOrNull();
  if (compressedLength == null) {
    return _originalLink;
  }

  return _originalLink.addProperties({"compressedLength": compressedLength});
}