From 8c6c9c687aa22d48413211707ff3c0ac2dbf0368 Mon Sep 17 00:00:00 2001 From: Greg Martin Date: Thu, 9 Apr 2026 14:59:00 -0400 Subject: [PATCH 1/4] fix(api-axios): filter undefined and null fields --- packages/api-axios/src/resources/dma.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/api-axios/src/resources/dma.js b/packages/api-axios/src/resources/dma.js index 6dc77ad4..042560ef 100644 --- a/packages/api-axios/src/resources/dma.js +++ b/packages/api-axios/src/resources/dma.js @@ -20,6 +20,7 @@ export default class AvLogMessagesApiV2 extends AvMicroserviceApi { flattened.X_XSRF_TOKEN = document.cookie.replace(/(?:(?:^|.*;\s*)XSRF-TOKEN\s*=\s*([^;]*).*$)|^.*$/, '$1'); const fields = Object.keys(flattened) + .filter((key) => flattened[key] != null) .map((key) => { const name = key.replaceAll(/\[\d+]/g, '[]'); const value = flattened[key]; From 457bd63e52a48be7fc86ac78e90faead9da1b492 Mon Sep 17 00:00:00 2001 From: Greg Martin Date: Thu, 9 Apr 2026 15:00:14 -0400 Subject: [PATCH 2/4] fix(api-axios): filter undefined and null fields --- packages/api-axios/src/resources/dma-cloud.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/api-axios/src/resources/dma-cloud.js b/packages/api-axios/src/resources/dma-cloud.js index 3ce1ac14..b5fe2652 100644 --- a/packages/api-axios/src/resources/dma-cloud.js +++ b/packages/api-axios/src/resources/dma-cloud.js @@ -21,6 +21,7 @@ export default class AvLogMessagesApiV3 extends AvMicroserviceApi { flattened.X_XSRF_TOKEN = document.cookie.replace(/(?:(?:^|.*;\s*)XSRF-TOKEN\s*=\s*([^;]*).*$)|^.*$/, '$1'); const fields = Object.keys(flattened) + .filter((key) => flattened[key] != null) .map((key) => { const name = key.replaceAll(/\[\d+]/g, '[]'); const value = flattened[key]; From 6bf07a8edf7615258a0382161c24a1af663f5d57 Mon Sep 17 00:00:00 2001 From: Greg Martin Date: Thu, 9 Apr 2026 15:01:32 -0400 Subject: [PATCH 3/4] test(api-axios): filter undefined and null fields --- .../src/resources/tests/dma-cloud.test.js | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/api-axios/src/resources/tests/dma-cloud.test.js b/packages/api-axios/src/resources/tests/dma-cloud.test.js index d762b5fb..f80d6b6a 100644 --- a/packages/api-axios/src/resources/tests/dma-cloud.test.js +++ b/packages/api-axios/src/resources/tests/dma-cloud.test.js @@ -15,11 +15,28 @@ describe('AvLogMessagesApiV3', () => { test('send should generate fields correctly', () => { const fields = api.send('info', { testField1: 'test1', testField2: 'test2'}); - expect(fields).toContain('level=info&entries.testField1=test1&entries.testField2=test2'); + expect(fields).toStrictEqual('level=info&entries.testField1=test1&entries.testField2=test2&X_XSRF_TOKEN='); }); test('send should generate optional overrides fields correctly', () => { const fields = api.send('info', { testField1: 'test1', testField2: 'test2', overrides: { akaName: 'override1', transactionId: 'override2' } }); - expect(fields).toContain('level=info&entries.testField1=test1&entries.testField2=test2&overrides.akaName=override1&overrides.transactionId=override2'); + expect(fields).toStrictEqual('level=info&entries.testField1=test1&entries.testField2=test2&overrides.akaName=override1&overrides.transactionId=override2&X_XSRF_TOKEN='); + }); + + test('send should not include undefined values in fields', () => { + const fields = api.send('info', { testField1: 'test1', testField2: undefined }); + expect(fields).toStrictEqual('level=info&entries.testField1=test1&X_XSRF_TOKEN='); + expect(fields).not.toContain('testField2'); + }); + + test('send should not include null values in fields', () => { + const fields = api.send('info', { testField1: 'test1', testField2: null }); + expect(fields).toStrictEqual('level=info&entries.testField1=test1&X_XSRF_TOKEN='); + expect(fields).not.toContain('testField2'); + }); + + test('send should not include overrides=undefined when overrides is not provided', () => { + const fields = api.send('info', { testField1: 'test1' }); + expect(fields).not.toContain('overrides'); }); }); From 272e62e4b4ddce09bda937c93f99451ddb0339be Mon Sep 17 00:00:00 2001 From: Greg Martin Date: Thu, 9 Apr 2026 15:02:11 -0400 Subject: [PATCH 4/4] test(api-axios): filter undefined and null fields --- .../api-axios/src/resources/tests/dma.test.js | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/api-axios/src/resources/tests/dma.test.js b/packages/api-axios/src/resources/tests/dma.test.js index 2781e867..70c896e8 100644 --- a/packages/api-axios/src/resources/tests/dma.test.js +++ b/packages/api-axios/src/resources/tests/dma.test.js @@ -15,11 +15,28 @@ describe('AvLogMessagesApiV2', () => { test('send should generate fields correctly', () => { const fields = api.send('info', { testField1: 'test1', testField2: 'test2'}); - expect(fields).toContain('level=info&entries.testField1=test1&entries.testField2=test2'); + expect(fields).toStrictEqual('level=info&entries.testField1=test1&entries.testField2=test2&X_XSRF_TOKEN='); }); test('send should generate optional overrides fields correctly', () => { const fields = api.send('info', { testField1: 'test1', testField2: 'test2', overrides: { akaName: 'override1', transactionId: 'override2' } }); - expect(fields).toContain('level=info&entries.testField1=test1&entries.testField2=test2&overrides.akaName=override1&overrides.transactionId=override2'); + expect(fields).toStrictEqual('level=info&entries.testField1=test1&entries.testField2=test2&overrides.akaName=override1&overrides.transactionId=override2&X_XSRF_TOKEN='); + }); + + test('send should not include undefined values in fields', () => { + const fields = api.send('info', { testField1: 'test1', testField2: undefined }); + expect(fields).toStrictEqual('level=info&entries.testField1=test1&X_XSRF_TOKEN='); + expect(fields).not.toContain('testField2'); + }); + + test('send should not include null values in fields', () => { + const fields = api.send('info', { testField1: 'test1', testField2: null }); + expect(fields).toStrictEqual('level=info&entries.testField1=test1&X_XSRF_TOKEN='); + expect(fields).not.toContain('testField2'); + }); + + test('send should not include overrides=undefined when overrides is not provided', () => { + const fields = api.send('info', { testField1: 'test1' }); + expect(fields).not.toContain('overrides'); }); });