@@ -848,6 +848,7 @@ fn validate_payload_limit(source: &str, binding: &MiddlewareBinding) -> Result<u
848848#[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
849849enum SupportedBinding {
850850 HttpPreCredentials ,
851+ HttpResponsePreReturn ,
851852 WebSocketPreCredentials ,
852853}
853854
@@ -863,9 +864,7 @@ fn supported_binding(source: &str, binding: &MiddlewareBinding) -> Result<Suppor
863864 (
864865 Some ( SupervisorMiddlewareOperation :: HttpResponse ) ,
865866 Some ( SupervisorMiddlewarePhase :: PreReturn ) ,
866- ) => Err ( miette ! (
867- "{source} advertises HTTP_RESPONSE/PRE_RETURN, which is not yet supported"
868- ) ) ,
867+ ) => Ok ( SupportedBinding :: HttpResponsePreReturn ) ,
869868 (
870869 Some ( SupervisorMiddlewareOperation :: WebsocketMessage ) ,
871870 Some ( SupervisorMiddlewarePhase :: PreCredentials ) ,
@@ -3703,7 +3702,7 @@ mod tests {
37033702 }
37043703
37053704 #[ test]
3706- fn manifest_rejects_http_response_pre_return_binding_until_dispatch_is_available ( ) {
3705+ fn manifest_accepts_http_response_pre_return_binding_when_dispatch_is_available ( ) {
37073706 let registration = external_registration ( 4096 ) ;
37083707 let manifest = MiddlewareManifest {
37093708 name : "example/response" . into ( ) ,
@@ -3717,13 +3716,8 @@ mod tests {
37173716 expected_audience : String :: new ( ) ,
37183717 } ;
37193718
3720- let error = validate_external_manifest ( & registration, & manifest, 4096 , false )
3721- . expect_err ( "HTTP response pre-return binding must remain unavailable" ) ;
3722- assert ! (
3723- error
3724- . to_string( )
3725- . contains( "HTTP_RESPONSE/PRE_RETURN, which is not yet supported" )
3726- ) ;
3719+ validate_external_manifest ( & registration, & manifest, 4096 , false )
3720+ . expect ( "HTTP response pre-return binding is supported" ) ;
37273721 }
37283722
37293723 #[ test]
0 commit comments