@@ -477,8 +477,9 @@ async fn native_wasm_cache_admission_budget_is_fair_across_vhosts() {
477477}
478478
479479#[ tokio:: test]
480- async fn native_wasm_request_and_response_headers_use_bounded_host_calls ( ) {
481- let fixture = WasmRouteFixture :: new ( & [ ( "headers" , WasmPluginBody :: HeaderPolicy ) ] ) ;
480+ async fn native_wasm_openresty_header_policy_example_uses_bounded_host_calls ( ) {
481+ let fixture =
482+ WasmRouteFixture :: new ( & [ ( "headers" , WasmPluginBody :: OpenRestyHeaderPolicyExample ) ] ) ;
482483 let upstream = upstream_expect_policy_header ( "/item" ) . await ;
483484 let mut config = fixture
484485 . config_with_attachments ( upstream, vec ! [ wasm_attachment_all( "headers" , "route" , 100 ) ] ) ;
@@ -1167,7 +1168,7 @@ async fn native_wasm_cache_store_can_set_bounded_stored_response_header() {
11671168async fn native_wasm_cross_family_chain_runs_in_order_with_cache_hit_metadata ( ) {
11681169 let fixture = WasmRouteFixture :: new ( & [
11691170 ( "access" , WasmPluginBody :: Decision ( 1 ) ) ,
1170- ( "headers" , WasmPluginBody :: HeaderPolicy ) ,
1171+ ( "headers" , WasmPluginBody :: OpenRestyHeaderPolicyExample ) ,
11711172 ( "router" , WasmPluginBody :: RouteDecision ) ,
11721173 ( "cache_key" , WasmPluginBody :: CacheLookupDeviceKey ) ,
11731174 ( "cache_store" , WasmPluginBody :: CacheStoreHeader ) ,
@@ -1746,7 +1747,8 @@ async fn native_wasm_cache_store_deny_wins_over_earlier_skip() {
17461747#[ cfg( feature = "php-fpm" ) ]
17471748#[ tokio:: test]
17481749async fn native_wasm_response_headers_apply_to_php_fpm_fallback ( ) {
1749- let fixture = WasmRouteFixture :: new ( & [ ( "headers" , WasmPluginBody :: HeaderPolicy ) ] ) ;
1750+ let fixture =
1751+ WasmRouteFixture :: new ( & [ ( "headers" , WasmPluginBody :: OpenRestyHeaderPolicyExample ) ] ) ;
17501752 let fpm = fastcgi_responder (
17511753 b"Status: 200 OK\r \n Content-Type: text/plain\r \n X-Powered-By: php\r \n \r \n php-policy" ,
17521754 )
@@ -1900,7 +1902,7 @@ impl WasmRouteFixture {
19001902enum WasmPluginBody {
19011903 Decision ( i32 ) ,
19021904 IrulesAccessPolicyExample ,
1903- HeaderPolicy ,
1905+ OpenRestyHeaderPolicyExample ,
19041906 ForbiddenHeader ,
19051907 RouteDecision ,
19061908 CacheLookup ,
@@ -1942,43 +1944,8 @@ impl WasmPluginBody {
19421944 Self :: IrulesAccessPolicyExample => {
19431945 include_str ! ( "../../../../examples/wasm/irules-access-policy.wat" ) . to_owned ( )
19441946 }
1945- Self :: HeaderPolicy => {
1946- r#"
1947- (module
1948- (import "fluxheim_policy_v1" "context" (func $context (param i32 i32) (result i32)))
1949- (import "fluxheim_policy_v1" "set_request_header" (func $set_request_header (param i32 i32) (result i32)))
1950- (import "fluxheim_policy_v1" "set_response_header" (func $set_response_header (param i32 i32) (result i32)))
1951- (import "fluxheim_policy_v1" "remove_response_header" (func $remove_response_header (param i32 i32) (result i32)))
1952- (func (export "fluxheim_request_headers") (result i32)
1953- i32.const 1
1954- i32.const 0
1955- call $context
1956- i32.const 3
1957- i32.eq
1958- if
1959- i32.const 1
1960- i32.const 4
1961- call $set_request_header
1962- drop
1963- else
1964- i32.const 1
1965- i32.const 1
1966- call $set_request_header
1967- drop
1968- end
1969- i32.const 0)
1970- (func (export "fluxheim_response_headers") (result i32)
1971- i32.const 2
1972- i32.const 4
1973- call $set_response_header
1974- drop
1975- i32.const 3
1976- i32.const 0
1977- call $remove_response_header
1978- drop
1979- i32.const 0))
1980- "#
1981- . to_owned ( )
1947+ Self :: OpenRestyHeaderPolicyExample => {
1948+ include_str ! ( "../../../../examples/wasm/openresty-header-policy.wat" ) . to_owned ( )
19821949 }
19831950 Self :: ForbiddenHeader => {
19841951 r#"
@@ -2358,7 +2325,7 @@ fn wasm_plugin(root: &Path, name: &str, body: WasmPluginBody) -> fluxheim_config
23582325
23592326fn wasm_plugin_phases ( body : WasmPluginBody ) -> Vec < fluxheim_config:: WasmPluginPhase > {
23602327 match body {
2361- WasmPluginBody :: HeaderPolicy => vec ! [
2328+ WasmPluginBody :: OpenRestyHeaderPolicyExample => vec ! [
23622329 fluxheim_config:: WasmPluginPhase :: RequestHeaders ,
23632330 fluxheim_config:: WasmPluginPhase :: ResponseHeaders ,
23642331 ] ,
0 commit comments