fix(api): 🚑 Remove hack to get text

This commit is contained in:
Jesse Wierzbinski 2024-06-26 16:14:12 -10:00
parent a93085ae1d
commit a6c5f320e3
No known key found for this signature in database
2 changed files with 3 additions and 3 deletions

View file

@ -4,7 +4,7 @@ import { config } from "~/packages/config-manager";
export const logger = createMiddleware(async (context, next) => { export const logger = createMiddleware(async (context, next) => {
if (config.logging.log_requests) { if (config.logging.log_requests) {
await debugRequest(context.req.raw, await context.req.text()); await debugRequest(context.req.raw.clone());
} }
await next(); await next();

View file

@ -395,8 +395,8 @@ export const jsonOrForm = () => {
}); });
}; };
export const debugRequest = async (req: Request, textBody?: string) => { export const debugRequest = async (req: Request) => {
const body = textBody ?? (await req.clone().text()); const body = await req.clone().text();
const logger = getLogger("server"); const logger = getLogger("server");
const urlAndMethod = `${chalk.green(req.method)} ${chalk.blue(req.url)}`; const urlAndMethod = `${chalk.green(req.method)} ${chalk.blue(req.url)}`;