fix(core): update

This commit is contained in:
Philipp Kunz 2022-03-29 09:48:47 +02:00
parent f7ef8a6828
commit ab75cf8720

View File

@ -87,7 +87,7 @@ export class TypedRouter {
* @param typedRequestArg
*/
public async routeAndAddResponse<T extends plugins.typedRequestInterfaces.ITypedRequest = any>(typedRequestArg: T): Promise<T> {
if (!typedRequestArg?.correlation?.phase || typedRequestArg.correlation.phase === 'request') {
if (typedRequestArg?.correlation?.phase === 'request') {
const typedHandler = this.getTypedHandlerForMethod(typedRequestArg.method);
if (!typedHandler) {
@ -100,7 +100,8 @@ export class TypedRouter {
}
typedRequestArg = await typedHandler.addResponse(typedRequestArg);
} else if (typedRequestArg.correlation.phase === 'response') {
return typedRequestArg;
} else if (typedRequestArg?.correlation?.phase === 'response') {
this.fireEventInterestMap
.findInterest(typedRequestArg.correlation.id)
?.fullfillInterest(typedRequestArg);
@ -109,6 +110,5 @@ export class TypedRouter {
console.log(typedRequestArg);
return null
}
return typedRequestArg;
}
}