Skip to content

Commit

Permalink
feat: add content type header
Browse files Browse the repository at this point in the history
  • Loading branch information
djereg committed Apr 22, 2024
1 parent 8f5fd74 commit 1beac00
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/event/event.emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/rpc/rpc.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export class RPCClient {
expiration: timeout / 2,
headers: {
"X-Message-Type": "rpc",
'Content-Type': 'application/json',
},
};

Expand Down
10 changes: 9 additions & 1 deletion src/rpc/rpc.listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 1beac00

Please sign in to comment.