FIX: pipeline accepting properties on payload

This commit is contained in:
Gabriel Rosa
2022-09-06 15:38:25 -03:00
parent 2c8ed40bc6
commit 01e74473c0
8 changed files with 114 additions and 73 deletions
+6 -9
View File
@@ -1,6 +1,6 @@
import { Metadata } from '@grpc/grpc-js';
interface Info {
interface IMetadata {
customer_id?: string;
customer_name?: string;
username?: string;
@@ -9,14 +9,11 @@ interface Info {
details?: string;
}
export const PackTheMetadata = (info: Info): Metadata => {
export function PackTheMetadata(info: IMetadata): Metadata {
const meta = new Metadata();
meta.add('customer_id', info.customer_id);
meta.add('customer_name', info.customer_name);
meta.add('user_id', info.user_id);
meta.add('username', info.username);
meta.add('details', info.details);
meta.add('language', info.language);
for (const key in info) {
meta.add(key, info[key]);
}
return meta;
};
}