fix(admin-web): runs proxy route — same DELETE body-forwarding fix
This commit is contained in:
parent
b6f9636171
commit
633fe855bf
@ -22,7 +22,7 @@ async function proxy(req: NextRequest, { params }: { params: Promise<{ path: str
|
||||
'x-product-id': req.headers.get('x-product-id') || process.env.PRODUCT_ID || 'lysnrai',
|
||||
};
|
||||
const fetchOptions: RequestInit = { method: req.method, headers };
|
||||
if (['POST', 'PUT', 'PATCH'].includes(req.method)) fetchOptions.body = await req.text();
|
||||
if (req.method !== 'GET' && req.method !== 'HEAD') fetchOptions.body = await req.text();
|
||||
const res = await fetch(`${PLATFORM_URL}${targetPath}${qs}`, fetchOptions);
|
||||
const data = await res.json().catch(() => null);
|
||||
return NextResponse.json(data ?? { error: res.statusText }, { status: res.status });
|
||||
|
||||
Loading…
Reference in New Issue
Block a user