Skip to content

Commit 91596a7

Browse files
committed
wip
1 parent 1036717 commit 91596a7

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

packages/browser/src/browser/__tests__/integration.test.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,3 +1533,37 @@ describe('Options', () => {
15331533
})
15341534
})
15351535
})
1536+
1537+
describe('setting headers', () => {
1538+
it('allows setting headers', async () => {
1539+
const [ajs] = await AnalyticsBrowser.load(
1540+
{
1541+
writeKey,
1542+
},
1543+
{
1544+
integrations: {
1545+
'Segment.io': {
1546+
deliveryStrategy: {
1547+
config: {
1548+
headers: {
1549+
'X-Test': 'foo',
1550+
},
1551+
},
1552+
},
1553+
},
1554+
},
1555+
}
1556+
)
1557+
1558+
await ajs.track('sup')
1559+
1560+
await sleep(10)
1561+
const [call] = fetchCalls.filter((el) =>
1562+
el.url.toString().includes('api.segment.io')
1563+
)
1564+
expect(call.headers).toEqual({
1565+
'Content-Type': 'text/plain',
1566+
'X-Test': 'foo',
1567+
})
1568+
})
1569+
})

0 commit comments

Comments
 (0)