From 96d4337b5989f42eb0153aef8509d7764c0df680 Mon Sep 17 00:00:00 2001 From: qcqcqc <1220204124@zust.edu.cn> Date: Thu, 22 Jan 2026 10:42:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9C=A8=E5=A4=84=E7=90=86=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E7=9A=84=E4=B8=AD=E9=97=B4=E4=BB=B6=E4=B8=AD=E6=9C=AA?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E5=A4=84=E7=90=86serializeException=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E7=9A=84headers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/server/start.js | 6 +++++- src/server/start.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/server/start.js b/lib/server/start.js index fded2be..4a85b66 100644 --- a/lib/server/start.js +++ b/lib/server/start.js @@ -204,8 +204,12 @@ async function startup(path, connector, omitWatchers, omitTimers, routine) { ? err : new types_1.OakException(serverConfiguration?.internalExceptionMask || ExceptionMask); - const { body } = connector.serializeException(exception, request.headers, request.body); + const { body, headers } = connector.serializeException(exception, request.headers, request.body); ctx.response.body = body; + // headers 要拼上 + Object.keys(headers || {}).forEach(key => { + ctx.set(key, headers?.[key]); + }); return; } }); diff --git a/src/server/start.ts b/src/server/start.ts index 126bcd9..541098f 100644 --- a/src/server/start.ts +++ b/src/server/start.ts @@ -251,12 +251,16 @@ export async function startup { + ctx.set(key, headers?.[key]) + }) return; } });