skylerdj
skylerdj
TtRPC
Created by skylerdj on 11/4/2024 in #❓-help
Calling Express `request.send` inside tRPC middleware/procedures
@Alex / KATT 🐱: You can pass a fake res-object to await runJWTValidations(req, res) Example that probably needs some modification:
const mockRes = {
// replace the method here
status: () => mockRes,
write: () => mockRes,
send: () => mockRes,
end: () => { },
} satisfies Partial<trpcExpress.CreateExpressContextOptions['res']>

await runJWTValidations(req, mockRes as trpcExpress.CreateExpressContextOptions['res']);
const mockRes = {
// replace the method here
status: () => mockRes,
write: () => mockRes,
send: () => mockRes,
end: () => { },
} satisfies Partial<trpcExpress.CreateExpressContextOptions['res']>

await runJWTValidations(req, mockRes as trpcExpress.CreateExpressContextOptions['res']);
3 replies