Skip to content

Commit

Permalink
Fixed a bug/typo in the subject field validation
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelgj committed Apr 22, 2022
1 parent d01532b commit 52242bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/eventarc/eventarc-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function toCloudEventProtoFormat(ce: CloudEvent): any {
});
}
if (ce.subject) {
if (!validator.isNonEmptyString(ce.datacontenttype)) {
if (!validator.isNonEmptyString(ce.subject)) {
throw new FirebaseEventarcError(
'invalid-argument',
"CloudEvent 'subject' if specified must be non-empty string.");
Expand Down
4 changes: 4 additions & 0 deletions test/unit/eventarc/eventarc-utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ describe('eventarc-utils', () => {
expect(utils.toCloudEventProtoFormat({
type: 'some.custom.event',
specversion: '1.0',
subject: 'context',
datacontenttype: 'application/json',
id: 'user-provided-id',
data: {
Expand All @@ -64,6 +65,9 @@ describe('eventarc-utils', () => {
},
'time': {
'ceTimestamp': '2022-03-16T20:20:42.212Z'
},
'subject': {
'ceString': 'context'
}
},
'id': 'user-provided-id',
Expand Down

0 comments on commit 52242bb

Please sign in to comment.