fix: 在处理异常的中间件中未正确处理serializeException返回的headers
This commit is contained in:
parent
fc5f551cab
commit
96d4337b59
|
|
@ -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;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -251,12 +251,16 @@ export async function startup<ED extends EntityDict & BaseEntityDict, FrontCxt e
|
|||
serverConfiguration?.internalExceptionMask ||
|
||||
ExceptionMask
|
||||
);
|
||||
const { body } = connector.serializeException(
|
||||
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;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue