message: backend-common: implement readUrl in UrlReaderPredicateMux, and have it fall back to read
diff: @@ -18,6 +18,8 @@ import { NotAllowedError } from '@backstage/errors';
  import {
  ReadTreeOptions,
  ReadTreeResponse,
  + ReadUrlOptions,
  + ReadUrlResponse,
  SearchOptions,
  SearchResponse,
  UrlReader,
  @@ -35,7 +37,7 @@ export class UrlReaderPredicateMux implements UrlReader {
  this.readers.push(tuple);
  }
  - read(url: string): Promise<Buffer> {
  + async read(url: string): Promise<Buffer> {
  const parsed = new URL(url);
  for (const { predicate, reader } of this.readers) {
  @@ -47,6 +49,27 @@ export class UrlReaderPredicateMux implements UrlReader {
  throw new NotAllowedError(`Reading from '${url}' is not allowed`);
  }
  + async readUrl(
  + url: string,
  + options?: ReadUrlOptions,
  + ): Promise<ReadUrlResponse> {
  + const parsed = new URL(url);
  +
  + for (const { predicate, reader } of this.readers) {
  + if (predicate(parsed)) {
  + if (reader.readUrl) {
  + return reader.readUrl(url, options);
  + }
  + const buffer = await reader.read(url);
  + return {
  + buffer: async () => buffer,
  + };
  + }
  + }
  +
  + throw new NotAllowedError(`Reading from '${url}' is not allowed`);
  + }
  +
  async readTree(
  url: string,
  options?: ReadTreeOptions,
  