fix: send headers to error rewrites

This commit is contained in:
Michael Zetterberg
2024-08-23 09:00:08 +02:00
parent 159114a082
commit efd2e1730c
5 changed files with 42 additions and 33 deletions

View File

@@ -23,17 +23,7 @@ export const { createCallerFactory, mergeRouters, router } = t
export const publicProcedure = t.procedure
export const contentstackBaseProcedure = t.procedure.use(async function (opts) {
if (!opts.ctx.lang) {
const input = await opts.getRawInput()
const parsedInput = langInput.safeParse(input)
if (!parsedInput.success) {
throw badRequestError("Missing Lang in tRPC context")
}
return opts.next({
ctx: {
lang: parsedInput.data.lang,
},
})
throw badRequestError("Missing Lang in tRPC context")
}
return opts.next({