Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
silesky committed Dec 18, 2024
1 parent d73a9c7 commit 6942d68
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/browser/src/plugins/segmentio/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,27 @@ describe('Segment.io', () => {
expect(params.headers['X-My-Header']).toBe('foo')
expect(params.headers['Content-Type']).toBe('text/plain')
})

it('should allow content type to be overridden', async () => {
const analytics = new Analytics({ writeKey: 'foo' })

await analytics.register(
await segmentio(analytics, {
apiKey: '',
deliveryStrategy: {
config: {
additionalHeaders: () => ({
'Content-Type': 'bar',
}),
},
},
})
)

await analytics.track('foo')
const [_, params] = spyMock.mock.lastCall
expect(params.headers['Content-Type']).toBe('bar')
})
})

describe('configuring fetch priority', () => {
Expand Down

0 comments on commit 6942d68

Please sign in to comment.