TRPC Middleware

How can I create a TRPC middleware function where I can inspect the HTTP headers? I'm in trpc.ts in the server and see the documentation, but I can't piece it all together.

export const activatedMiddleware = t.middleware(async (opts) => {
  const { ctx } = opts;

  return opts.next(opts);

})


I have this so far and would like to check the request headers.
Was this page helpful?