mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-20 07:21:26 +02:00
refactor(rules): improve termination detection and block parsing logic
Refactors the termination detection in the rules DSL to properly handle if-block and if-else-block commands. Adds new functions `commandsTerminateInPre`, `commandTerminatesInPre`, and `ifElseBlockTerminatesInPre` to recursively check if command sequences terminate in the pre-phase. Also improves the Parse function to try block syntax first with proper error handling and fallback to YAML. Includes test cases for dead code detection with terminating handlers in conditional blocks.
This commit is contained in:
@@ -420,7 +420,7 @@ func TestHTTPFlow_HeaderManipulation(t *testing.T) {
|
||||
|
||||
var rules Rules
|
||||
err := parseRules(`
|
||||
default {
|
||||
{
|
||||
remove resp_header X-Secret
|
||||
add resp_header X-Custom-Header custom-value
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user