Skip to content

Commit 6942d68

Browse files
committed
wip
1 parent d73a9c7 commit 6942d68

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

packages/browser/src/plugins/segmentio/__tests__/index.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,27 @@ describe('Segment.io', () => {
109109
expect(params.headers['X-My-Header']).toBe('foo')
110110
expect(params.headers['Content-Type']).toBe('text/plain')
111111
})
112+
113+
it('should allow content type to be overridden', async () => {
114+
const analytics = new Analytics({ writeKey: 'foo' })
115+
116+
await analytics.register(
117+
await segmentio(analytics, {
118+
apiKey: '',
119+
deliveryStrategy: {
120+
config: {
121+
additionalHeaders: () => ({
122+
'Content-Type': 'bar',
123+
}),
124+
},
125+
},
126+
})
127+
)
128+
129+
await analytics.track('foo')
130+
const [_, params] = spyMock.mock.lastCall
131+
expect(params.headers['Content-Type']).toBe('bar')
132+
})
112133
})
113134

114135
describe('configuring fetch priority', () => {

0 commit comments

Comments
 (0)