Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty datastream overrides are no longer sent to the Edge Network, reducing potential conflicts with server side routing configurations #1199

Merged
merged 3 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/utils/request/createRequestParams.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
import {isEmptyObject} from "../index.js";

/**
* @typedef {{ datastreamId: string, [k: string]: Object }} Override
* @typedef {Object} RequestPayload
Expand All @@ -26,7 +28,13 @@ export default ({ localConfigOverrides, globalConfigOverrides, payload }) => {
if (datastreamId) {
requestParams.datastreamIdOverride = datastreamId;
}
payload.mergeConfigOverride(globalConfigOverrides);
payload.mergeConfigOverride(localConfigOverridesWithoutDatastreamId);

if (globalConfigOverrides && !isEmptyObject(globalConfigOverrides)) {
payload.mergeConfigOverride(globalConfigOverrides);
}

if (localConfigOverridesWithoutDatastreamId && !isEmptyObject(localConfigOverridesWithoutDatastreamId)) {
payload.mergeConfigOverride(localConfigOverridesWithoutDatastreamId);
}
return requestParams;
};
19 changes: 19 additions & 0 deletions test/functional/specs/Config Overrides/C7437530.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,25 @@ test("Test C7437530: `sendEvent` can receive config overrides in command options
await t.expect(request.meta.state.domain).ok();
});

test("Test C7437530: `sendEvent` doesn't contain empty configOverrides if edgeConfigOverrides are not in options", async () => {
const alloy = createAlloyProxy();
await alloy.configure(config);
await alloy.sendEvent({});

await responseStatus(networkLogger.edgeEndpointLogs.requests, [200, 207]);

await t.expect(networkLogger.edgeEndpointLogs.requests.length).eql(1);

const request = JSON.parse(
networkLogger.edgeEndpointLogs.requests[0].request.body,
);

await t
.expect(request.events[0].xdm.implementationDetails.name)
.eql("https://ns.adobe.com/experience/alloy");
await t.expect(request.meta.configOverrides).eql(undefined);
});

test("Test C7437530: `sendEvent` can receive config overrides from configure", async () => {
const alloy = createAlloyProxy();
await alloy.configure(
Expand Down
Loading