diff --git a/libraries/botframework-streaming-extensions/src/Payloads/HeaderSerializer.ts b/libraries/botframework-streaming-extensions/src/Payloads/HeaderSerializer.ts index 695d103723..456ce9154a 100644 --- a/libraries/botframework-streaming-extensions/src/Payloads/HeaderSerializer.ts +++ b/libraries/botframework-streaming-extensions/src/Payloads/HeaderSerializer.ts @@ -59,7 +59,7 @@ export class HeaderSerializer { throw Error('Header Type is missing or malformed.'); } - if (!header.id || !header.id.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i) || header.id.length !== this.IdLength) { + if (!header.id || !header.id.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i) || header.id.length !== this.IdLength) { throw Error('Header ID is missing or malformed.'); } diff --git a/libraries/botframework-streaming-extensions/tests/HeaderSerializer.test.js b/libraries/botframework-streaming-extensions/tests/HeaderSerializer.test.js index 63ec56fd41..ebbb449dc4 100644 --- a/libraries/botframework-streaming-extensions/tests/HeaderSerializer.test.js +++ b/libraries/botframework-streaming-extensions/tests/HeaderSerializer.test.js @@ -116,4 +116,15 @@ describe('HeaderSerializer', () => { .throws('Header ID is missing or malformed.'); }); + it('accepts nil GUIDs as valid header IDs', () => { + let buffer = Buffer.alloc(Number(PayloadConstants.PayloadConstants.MaxHeaderLength)); + buffer.write('A.000168.00000000-0000-0000-0000-000000000000.1\n'); + + let result = HeaderSerializer.HeaderSerializer.deserialize(buffer); + + expect(result.id) + .to + .deep + .equal('00000000-0000-0000-0000-000000000000'); + }); });