From 1beac00a20232f04c0abb0ef90a05503e02194c6 Mon Sep 17 00:00:00 2001 From: djereg Date: Mon, 22 Apr 2024 20:09:51 +0200 Subject: [PATCH] feat: add content type header --- src/event/event.emitter.ts | 1 + src/rpc/rpc.client.ts | 1 + src/rpc/rpc.listener.ts | 10 +++++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/event/event.emitter.ts b/src/event/event.emitter.ts index 6b40460..09395f5 100644 --- a/src/event/event.emitter.ts +++ b/src/event/event.emitter.ts @@ -18,6 +18,7 @@ export class EventEmitter { headers: { 'X-Message-Type': 'event', 'X-Event-Name': event, + 'Content-Type': 'application/json', }, contentType: 'application/json', priority: 0, diff --git a/src/rpc/rpc.client.ts b/src/rpc/rpc.client.ts index b0d0c00..432d858 100644 --- a/src/rpc/rpc.client.ts +++ b/src/rpc/rpc.client.ts @@ -76,6 +76,7 @@ export class RPCClient { expiration: timeout / 2, headers: { "X-Message-Type": "rpc", + 'Content-Type': 'application/json', }, }; diff --git a/src/rpc/rpc.listener.ts b/src/rpc/rpc.listener.ts index 281a82e..98e16a8 100644 --- a/src/rpc/rpc.listener.ts +++ b/src/rpc/rpc.listener.ts @@ -37,7 +37,15 @@ export class RPCListener implements OnModuleInit { } const { replyTo, deliveryMode, correlationId, contentType } = raw.properties; - const options = { deliveryMode, correlationId, contentType, headers: {} }; + + const options = { + deliveryMode, + correlationId, + contentType, + headers: { + 'Content-Type': 'application/json', + } + }; await this.rmq.publish('', replyTo, response, options); }