Know if a response has a media property/entity before return

I want to do the same thing that this drupal module does.
https://www.drupal.org/project/stage_file_proxy

strapi.router.get('*', async (ctx, next) => {
      console.log('Middleware GET', {ctx});
      await next();
      console.log('Middleware END', {ctx});
})

This code is in the middleware for each request and in the headers I cannot see if there are any fields of type media.

I would have to iterate all the rows to see if there are any fields of type media.

Maybe I can take the entity structure and see what types of fields it has.

Is this a good idea?