Merged in fix/headers-for-errors (pull request #466)
fix: send headers to error rewrites Approved-by: Arvid Norlin
This commit is contained in:
@@ -40,17 +40,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({
|
||||
|
||||
Reference in New Issue
Block a user