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