@@ -398,7 +398,7 @@ describe('getSanitizedUrlStringFromUrlObject', () => {
398
398
399
399
describe ( 'getHttpSpanDetailsFromUrlObject' , ( ) => {
400
400
it ( 'handles undefined URL object' , ( ) => {
401
- const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( undefined , 'test-origin' ) ;
401
+ const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( undefined , 'server' , ' test-origin') ;
402
402
expect ( name ) . toBe ( 'GET /' ) ;
403
403
expect ( attributes ) . toEqual ( {
404
404
'sentry.origin' : 'test-origin' ,
@@ -408,7 +408,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => {
408
408
409
409
it ( 'handles relative URL object' , ( ) => {
410
410
const urlObject = parseStringToURLObject ( '/api/users' ) ! ;
411
- const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'test-origin' ) ;
411
+ const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'server' , ' test-origin') ;
412
412
expect ( name ) . toBe ( 'GET /api/users' ) ;
413
413
expect ( attributes ) . toEqual ( {
414
414
'sentry.origin' : 'test-origin' ,
@@ -419,7 +419,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => {
419
419
420
420
it ( 'handles absolute URL object' , ( ) => {
421
421
const urlObject = parseStringToURLObject ( 'https://example.com/api/users?q=test#section' ) ! ;
422
- const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'test-origin' ) ;
422
+ const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'server' , ' test-origin') ;
423
423
expect ( name ) . toBe ( 'GET https://example.com/api/users' ) ;
424
424
expect ( attributes ) . toEqual ( {
425
425
'sentry.origin' : 'test-origin' ,
@@ -435,7 +435,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => {
435
435
436
436
it ( 'handles URL object with request method' , ( ) => {
437
437
const urlObject = parseStringToURLObject ( 'https://example.com/api/users' ) ! ;
438
- const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'test-origin' , { method : 'POST' } ) ;
438
+ const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'server' , ' test-origin', { method : 'POST' } ) ;
439
439
expect ( name ) . toBe ( 'POST https://example.com/api/users' ) ;
440
440
expect ( attributes ) . toEqual ( {
441
441
'sentry.origin' : 'test-origin' ,
@@ -450,7 +450,13 @@ describe('getHttpSpanDetailsFromUrlObject', () => {
450
450
451
451
it ( 'handles URL object with route name' , ( ) => {
452
452
const urlObject = parseStringToURLObject ( 'https://example.com/api/users' ) ! ;
453
- const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'test-origin' , undefined , '/api/users/:id' ) ;
453
+ const [ name , attributes ] = getHttpSpanDetailsFromUrlObject (
454
+ urlObject ,
455
+ 'server' ,
456
+ 'test-origin' ,
457
+ undefined ,
458
+ '/api/users/:id' ,
459
+ ) ;
454
460
expect ( name ) . toBe ( 'GET /api/users/:id' ) ;
455
461
expect ( attributes ) . toEqual ( {
456
462
'sentry.origin' : 'test-origin' ,
@@ -465,7 +471,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => {
465
471
466
472
it ( 'handles root path URL' , ( ) => {
467
473
const urlObject = parseStringToURLObject ( 'https://example.com/' ) ! ;
468
- const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'test-origin' ) ;
474
+ const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'server' , ' test-origin') ;
469
475
expect ( name ) . toBe ( 'GET https://example.com/' ) ;
470
476
expect ( attributes ) . toEqual ( {
471
477
'sentry.origin' : 'test-origin' ,
@@ -479,7 +485,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => {
479
485
480
486
it ( 'handles URL with port' , ( ) => {
481
487
const urlObject = parseStringToURLObject ( 'https://example.com:8080/api/users' ) ! ;
482
- const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'test-origin' ) ;
488
+ const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'server' , ' test-origin') ;
483
489
expect ( name ) . toBe ( 'GET https://example.com:8080/api/users' ) ;
484
490
expect ( attributes ) . toEqual ( {
485
491
'sentry.origin' : 'test-origin' ,
@@ -494,7 +500,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => {
494
500
495
501
it ( 'handles URL with non-standard port and request method' , ( ) => {
496
502
const urlObject = parseStringToURLObject ( 'https://example.com:3000/api/users' ) ! ;
497
- const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'test-origin' , { method : 'PUT' } ) ;
503
+ const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'server' , ' test-origin', { method : 'PUT' } ) ;
498
504
expect ( name ) . toBe ( 'PUT https://example.com:3000/api/users' ) ;
499
505
expect ( attributes ) . toEqual ( {
500
506
'sentry.origin' : 'test-origin' ,
@@ -512,6 +518,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => {
512
518
const urlObject = parseStringToURLObject ( 'https://example.com/api/users/123' ) ! ;
513
519
const [ name , attributes ] = getHttpSpanDetailsFromUrlObject (
514
520
urlObject ,
521
+ 'server' ,
515
522
'test-origin' ,
516
523
{ method : 'PATCH' } ,
517
524
'/api/users/:id' ,
@@ -531,7 +538,13 @@ describe('getHttpSpanDetailsFromUrlObject', () => {
531
538
532
539
it ( 'handles URL with query params and route name' , ( ) => {
533
540
const urlObject = parseStringToURLObject ( 'https://example.com/api/search?q=test&page=1' ) ! ;
534
- const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'test-origin' , undefined , '/api/search' ) ;
541
+ const [ name , attributes ] = getHttpSpanDetailsFromUrlObject (
542
+ urlObject ,
543
+ 'server' ,
544
+ 'test-origin' ,
545
+ undefined ,
546
+ '/api/search' ,
547
+ ) ;
535
548
expect ( name ) . toBe ( 'GET /api/search' ) ;
536
549
expect ( attributes ) . toEqual ( {
537
550
'sentry.origin' : 'test-origin' ,
@@ -547,7 +560,13 @@ describe('getHttpSpanDetailsFromUrlObject', () => {
547
560
548
561
it ( 'handles URL with fragment and route name' , ( ) => {
549
562
const urlObject = parseStringToURLObject ( 'https://example.com/api/docs#section-1' ) ! ;
550
- const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'test-origin' , undefined , '/api/docs' ) ;
563
+ const [ name , attributes ] = getHttpSpanDetailsFromUrlObject (
564
+ urlObject ,
565
+ 'server' ,
566
+ 'test-origin' ,
567
+ undefined ,
568
+ '/api/docs' ,
569
+ ) ;
551
570
expect ( name ) . toBe ( 'GET /api/docs' ) ;
552
571
expect ( attributes ) . toEqual ( {
553
572
'sentry.origin' : 'test-origin' ,
@@ -563,7 +582,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => {
563
582
564
583
it ( 'handles URL with auth credentials' , ( ) => {
565
584
const urlObject = parseStringToURLObject ( 'https://user:[email protected] /api/users' ) ! ;
566
- const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'test-origin' ) ;
585
+ const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'server' , ' test-origin') ;
567
586
expect ( name ) . toBe ( 'GET https://%filtered%:%filtered%@example.com/api/users' ) ;
568
587
expect ( attributes ) . toEqual ( {
569
588
'sentry.origin' : 'test-origin' ,
@@ -577,7 +596,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => {
577
596
578
597
it ( 'handles URL with IPv4 address' , ( ) => {
579
598
const urlObject = parseStringToURLObject ( 'https://192.168.1.1:8080/api/users' ) ! ;
580
- const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'test-origin' ) ;
599
+ const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'server' , ' test-origin') ;
581
600
expect ( name ) . toBe ( 'GET https://192.168.1.1:8080/api/users' ) ;
582
601
expect ( attributes ) . toEqual ( {
583
602
'sentry.origin' : 'test-origin' ,
@@ -592,7 +611,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => {
592
611
593
612
it ( 'handles URL with IPv6 address' , ( ) => {
594
613
const urlObject = parseStringToURLObject ( 'https://[2001:db8::1]:8080/api/users' ) ! ;
595
- const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'test-origin' ) ;
614
+ const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'server' , ' test-origin') ;
596
615
expect ( name ) . toBe ( 'GET https://[2001:db8::1]:8080/api/users' ) ;
597
616
expect ( attributes ) . toEqual ( {
598
617
'sentry.origin' : 'test-origin' ,
@@ -607,7 +626,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => {
607
626
608
627
it ( 'handles URL with subdomain' , ( ) => {
609
628
const urlObject = parseStringToURLObject ( 'https://api.example.com/users' ) ! ;
610
- const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'test-origin' ) ;
629
+ const [ name , attributes ] = getHttpSpanDetailsFromUrlObject ( urlObject , 'server' , ' test-origin') ;
611
630
expect ( name ) . toBe ( 'GET https://api.example.com/users' ) ;
612
631
expect ( attributes ) . toEqual ( {
613
632
'sentry.origin' : 'test-origin' ,
0 commit comments