Skip to content

Commit 88e4df7

Browse files
Added tests for #7518
Signed-off-by: prettysunflower <me@prettysunflower.moe>
1 parent 559af58 commit 88e4df7

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import testdata/issue_7518_unused_block_panic_snippets.conf
2+
3+
example.com {
4+
import snippet
5+
}
6+
----------
7+
{
8+
"apps": {
9+
"http": {
10+
"servers": {
11+
"srv0": {
12+
"listen": [
13+
":443"
14+
],
15+
"routes": [
16+
{
17+
"match": [
18+
{
19+
"host": [
20+
"example.com"
21+
]
22+
}
23+
],
24+
"handle": [
25+
{
26+
"handler": "subroute",
27+
"routes": [
28+
{
29+
"handle": [
30+
{
31+
"handler": "headers",
32+
"response": {
33+
"set": {
34+
"Reverse_proxy": [
35+
"localhost:3000"
36+
]
37+
}
38+
}
39+
}
40+
]
41+
}
42+
]
43+
}
44+
],
45+
"terminal": true
46+
}
47+
]
48+
}
49+
}
50+
}
51+
}
52+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Used by import_block_snippet_non_replaced_block_from_separate_file.caddyfiletest
2+
3+
(snippet) {
4+
header {
5+
reverse_proxy localhost:3000
6+
{block}
7+
}
8+
}
9+
10+
# This snippet being unused by the test Caddyfile is intentional.
11+
# This is to test that a panic runtime error triggered by an out-of-range slice index access
12+
# will not happen again, please see issue #7518 and pull request #7543 for more information
13+
(unused_snippet) {
14+
header SomeHeader SomeValue
15+
}

0 commit comments

Comments
 (0)