From f80d19e305cc6efb9884c57328be67dc5e187438 Mon Sep 17 00:00:00 2001 From: sijinhui Date: Tue, 9 Apr 2024 16:56:50 +0800 Subject: [PATCH] fix midjouney to 100% error --- app/api/midjourney/[...path]/route.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/api/midjourney/[...path]/route.ts b/app/api/midjourney/[...path]/route.ts index bc5cbfdf0..55d6bd5ea 100644 --- a/app/api/midjourney/[...path]/route.ts +++ b/app/api/midjourney/[...path]/route.ts @@ -88,11 +88,17 @@ async function handle( statusText: res.statusText, }); } - - return res; + // console.log('[mj res]', await res.json()) + return NextResponse.json(await res.json(), { + status: res.status, + statusText: res.statusText, + }); + } catch (e) { + console.log("[mj error]", e); } finally { clearTimeout(timeoutId); } + return NextResponse.json({ error: "未知错误" }, { status: 400 }); } export const GET = handle;