@@ -445,6 +445,15 @@ TEST_CASE("span extraction") {
445445 TraceID (123 ),
446446 456 ,
447447 2 },
448+ {__LINE__,
449+ " datadog style with leading and trailing spaces" ,
450+ {PropagationStyle::DATADOG},
451+ {{" x-datadog-trace-id" , " 123 " },
452+ {" x-datadog-parent-id" , " 456 " },
453+ {" x-datadog-sampling-priority" , " 2 " }},
454+ TraceID (123 ),
455+ 456 ,
456+ 2 },
448457 {__LINE__,
449458 " datadog style without sampling priority" ,
450459 {PropagationStyle::DATADOG},
@@ -468,6 +477,15 @@ TEST_CASE("span extraction") {
468477 TraceID (0xabc ),
469478 0xdef ,
470479 0 },
480+ {__LINE__,
481+ " B3 style with leading and trailing spaces" ,
482+ {PropagationStyle::B3},
483+ {{" x-b3-traceid" , " abc " },
484+ {" x-b3-spanid" , " def " },
485+ {" x-b3-sampled" , " 0 " }},
486+ TraceID (0xabc ),
487+ 0xdef ,
488+ 0 },
471489 {__LINE__,
472490 " B3 style without sampling priority" ,
473491 {PropagationStyle::B3},
@@ -598,6 +616,13 @@ TEST_CASE("span extraction") {
598616 67667974448284343ULL , // expected_parent_id
599617 1 }, // expected_sampling_priority
600618
619+ {__LINE__, " valid: w3.org example 1 with leading and trailing spaces" ,
620+ " 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01 " , // traceparent
621+ nullopt ,
622+ *TraceID::parse_hex (" 4bf92f3577b34da6a3ce929d0e0e4736" ), // expected_trace_id
623+ 67667974448284343ULL , // expected_parent_id
624+ 1 }, // expected_sampling_priority
625+
601626 {__LINE__, " valid: w3.org example 2" ,
602627 " 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-00" , // traceparent
603628 nullopt ,
0 commit comments