Nivoa
Nivoa2w ago

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;
}),
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;
}),
0 Replies
No replies yetBe the first to reply to this messageJoin