NivoaN
tRPC2y ago
1 reply
Nivoa

How to set up custom response headers at procedure level

hello guys, i'd like to know how to set up custom headers per procedure. I am aware of the responseMeta, but thats general. I'd like something more fine-grained.

Something like this but doesnt work:

getPoolByPoolId: publicProcedure.query(async ({ ctx }) => {
    const pool = await ctx.raydiumClient.fetchJupTokenList(
      JupTokenType.Strict,
      true,
    );
    // ctx.headers["Cache-Controlz"] = "public, max-age=600";
    if ("headers" in ctx) {
      ctx.headers.append("x-test-Control", "public, max-age=600");
      console.log("ctx.headers", ctx.headers);
    }
    return pool;
  }),
Was this page helpful?