File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed
packages/browser/src/core/user Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @segment/analytics-next ' : patch
3+ ---
4+
5+ Fixes an issue where the 'secure' cookie setting was not being applied correctly when specified.
Original file line number Diff line number Diff line change @@ -513,6 +513,22 @@ describe('user', () => {
513513 expect ( cookie [ 'options' ] . domain ) . toBe ( 'foo' )
514514 expect ( cookie [ 'options' ] . secure ) . toBe ( true )
515515 expect ( cookie [ 'options' ] . path ) . toBe ( '/test' )
516+ expect ( cookie [ 'options' ] . secure ) . toBe ( true )
517+ } )
518+
519+ it ( 'should pass options when creating cookie' , ( ) => {
520+ const jarSpy = jest . spyOn ( jar , 'set' )
521+ const cookie = new Cookie ( { domain : 'foo' , secure : true , path : '/test' } )
522+
523+ cookie . set ( 'foo' , 'bar' )
524+
525+ expect ( jarSpy ) . toHaveBeenCalledWith ( 'foo' , 'bar' , {
526+ domain : 'foo' ,
527+ expires : 365 ,
528+ path : '/test' ,
529+ sameSite : 'Lax' ,
530+ secure : true ,
531+ } )
516532 } )
517533 } )
518534
Original file line number Diff line number Diff line change @@ -92,6 +92,7 @@ export class Cookie extends Store {
9292 expires : this . options . maxage ,
9393 domain : this . options . domain ,
9494 path : this . options . path ,
95+ secure : this . options . secure ,
9596 }
9697 }
9798
You can’t perform that action at this time.
0 commit comments