File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
packages/browser/src/browser/__tests__ Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff 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+ } )
You can’t perform that action at this time.
0 commit comments