@@ -694,16 +694,52 @@ fn static_tsjs_route_returns_not_found_for_unknown_tsjs_bundle() {
694694
695695#[ test]
696696fn unknown_route_falls_back_to_publisher_proxy_path ( ) {
697- let mut settings = create_test_settings ( ) ;
698- settings. publisher . origin_url = "https://publisher-origin.invalid" . to_string ( ) ;
697+ let settings = create_test_settings ( ) ;
698+ let ( orchestrator, integration_registry) = build_route_stack ( & settings) ;
699+
699700 let req = Request :: get ( "https://test.com/articles/example" ) ;
701+ let http_client = Arc :: new ( RecordingHttpClient :: new ( StatusCode :: BAD_GATEWAY ) ) ;
702+ let services = test_runtime_services_with_http_client (
703+ & req,
704+ Arc :: new ( FixedBackend ) ,
705+ Arc :: clone ( & http_client) as Arc < dyn PlatformHttpClient > ,
706+ ) ;
700707
701- let response = route_with_settings ( & settings, req, "should route publisher fallback" ) ;
708+ let response = route_buffered_response (
709+ & settings,
710+ & orchestrator,
711+ & integration_registry,
712+ & services,
713+ req,
714+ "should route publisher fallback" ,
715+ ) ;
702716
703717 assert_eq ! (
704718 response. get_status( ) ,
705719 StatusCode :: BAD_GATEWAY ,
706- "should reach publisher proxy fallback and fail as an origin proxy error"
720+ "should return the publisher origin response through fallback routing"
721+ ) ;
722+ let calls = http_client
723+ . calls
724+ . lock ( )
725+ . expect ( "should lock recorded calls" ) ;
726+ assert_eq ! (
727+ calls. len( ) ,
728+ 1 ,
729+ "should send exactly one publisher fallback request"
730+ ) ;
731+ assert_eq ! (
732+ calls[ 0 ] . method,
733+ Method :: GET ,
734+ "should preserve the fallback request method"
735+ ) ;
736+ assert_eq ! (
737+ calls[ 0 ] . backend_name, "https-origin.test-publisher.com" ,
738+ "should dispatch to the publisher origin backend"
739+ ) ;
740+ assert_eq ! (
741+ calls[ 0 ] . uri, "https://origin.test-publisher.com/articles/example" ,
742+ "should send the fallback request to the publisher origin"
707743 ) ;
708744}
709745
0 commit comments