2分钟
内联多行操作值
在v1.12.12之前的版本,操作值有三种存储方式:
- 内联到规则里面(
pattern protocol://(value)
),value
不能有空格 - 直接存放到 Values(
pattern protocol://{key}
) - 存放到本地文件或目录(
pattern protocol:///User/xxx
)
whistle v1.12.12开始支持在Rules内联多行的Value,如:
www.test.com/index.html file://{test.html}
``` test.html
Hello world.
Hello world1.
Hello world2.
```
www.test.com/index2.html reqScript://{test.rules}
```` test.rules
* file://{test.html} # 表示下面的test.html,无法获取上面的test.html
``` test.html
reqScrip,
reqScript,
```
````
这种内联值位置可以在Rules里面任意放置,格式如下:
``` keyName
content
```
这样可以在Rules里面的任意位置引用该内容:
pattern protocol://{keyName}
这种方式设置的Value只对当前阶段的规则生效,且优先级高于Values设置的Key-Value,所以如果是插件里面的规则最好能加个前缀如:
```whistle.helloworld/test.html
Hello world.
Hello world1.
Hello world2.
```
www.test.com/index.html file://{whistle.helloworld/test.html}
学员评价