Skip to content

Commit c7cf6e5

Browse files
committed
2 parents a82ec66 + 510d2c5 commit c7cf6e5

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/ResponseValidator.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,12 @@ export class ResponseValidator {
187187
}
188188
}
189189
else if (result[name] !== value) {
190-
result[name] = [result[name], value];
190+
if (typeof value === 'object') {
191+
result[name] = this._mergeClaims(result[name], value);
192+
}
193+
else {
194+
result[name] = [result[name], value];
195+
}
191196
}
192197
}
193198
}

test/unit/ResponseValidator.spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,14 @@ describe("ResponseValidator", function () {
538538

539539
});
540540

541+
it("should merge claims when claim types are objects", function () {
542+
543+
var c1 = { custom: {'apple': 'foo', 'pear': 'bar'} };
544+
var c2 = { custom: {'apple': 'foo', 'orange': 'peel'}, b: 'banana' };
545+
var result = subject._mergeClaims(c1, c2);
546+
result.should.deep.equal({ custom: {'apple': 'foo', 'pear': 'bar', 'orange': 'peel'}, b: 'banana' });
547+
});
548+
541549
it("should merge same claim types into array", function () {
542550

543551
var c1 = { a: 'apple', b: 'banana' };

0 commit comments

Comments
 (0)