Skip to content

Commit

Permalink
Add W3C to default first party hosts headers
Browse files Browse the repository at this point in the history
  • Loading branch information
louiszawadzki committed Nov 6, 2023
1 parent ad332ee commit f05b1a2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
5 changes: 4 additions & 1 deletion packages/core/src/DdSdkReactNativeConfiguration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ export const formatFirstPartyHosts = (
if (isLegacyFirstPartyHost(host)) {
return {
match: host,
propagatorTypes: [PropagatorType.DATADOG]
propagatorTypes: [
PropagatorType.DATADOG,
PropagatorType.TRACECONTEXT
]
};
}
return host;
Expand Down
20 changes: 16 additions & 4 deletions packages/core/src/__tests__/DdSdkReactNative.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,14 @@ describe('DdSdkReactNative', () => {
'_dd.native_view_tracking': false,
'_dd.native_interaction_tracking': false,
'_dd.first_party_hosts': [
{ match: 'api.example.com', propagatorTypes: ['datadog'] },
{ match: 'something.fr', propagatorTypes: ['datadog'] }
{
match: 'api.example.com',
propagatorTypes: ['datadog', 'tracecontext']
},
{
match: 'something.fr',
propagatorTypes: ['datadog']
}
]
});
expect(DdRumResourceTracking.startTracking).toHaveBeenCalledTimes(
Expand All @@ -524,8 +530,14 @@ describe('DdSdkReactNative', () => {
expect(DdRumResourceTracking.startTracking).toHaveBeenCalledWith({
tracingSamplingRate: 42,
firstPartyHosts: [
{ match: 'api.example.com', propagatorTypes: ['datadog'] },
{ match: 'something.fr', propagatorTypes: ['datadog'] }
{
match: 'api.example.com',
propagatorTypes: ['datadog', 'tracecontext']
},
{
match: 'something.fr',
propagatorTypes: ['datadog']
}
]
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,12 @@ describe('DatadogProvider', () => {
expect(
NativeModules.DdSdk.initialize.mock.calls[0][0]
.additionalConfig['_dd.first_party_hosts']
).toEqual([{ match: 'api.com', propagatorTypes: ['datadog'] }]);
).toEqual([
{
match: 'api.com',
propagatorTypes: ['datadog', 'tracecontext']
}
]);
expect(NativeModules.DdRum.addAction).toHaveBeenCalledTimes(1);
});
});
Expand Down

0 comments on commit f05b1a2

Please sign in to comment.