From feeb6af40334e6826a57a1a83cc62db672b9b023 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Wed, 1 May 2024 07:43:05 -0400 Subject: httpcaddyfile: Fix expression matcher shortcut in snippets (#6288) --- .../expression_quotes.caddyfiletest | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'caddytest') diff --git a/caddytest/integration/caddyfile_adapt/expression_quotes.caddyfiletest b/caddytest/integration/caddyfile_adapt/expression_quotes.caddyfiletest index e0f5bd715..4bc47a3dc 100644 --- a/caddytest/integration/caddyfile_adapt/expression_quotes.caddyfiletest +++ b/caddytest/integration/caddyfile_adapt/expression_quotes.caddyfiletest @@ -1,3 +1,7 @@ +(snippet) { + @g `{http.error.status_code} == 404` +} + example.com @a expression {http.error.status_code} == 400 @@ -14,6 +18,12 @@ abort @d @e expression `{http.error.status_code} == 404` abort @e + +@f `{http.error.status_code} == 404` +abort @f + +import snippet +abort @g ---------- { "apps": { @@ -106,6 +116,38 @@ abort @e } } ] + }, + { + "handle": [ + { + "abort": true, + "handler": "static_response" + } + ], + "match": [ + { + "expression": { + "expr": "{http.error.status_code} == 404", + "name": "f" + } + } + ] + }, + { + "handle": [ + { + "abort": true, + "handler": "static_response" + } + ], + "match": [ + { + "expression": { + "expr": "{http.error.status_code} == 404", + "name": "g" + } + } + ] } ] } -- cgit v1.2.3