-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample_config.yaml
More file actions
69 lines (69 loc) · 2.03 KB
/
sample_config.yaml
File metadata and controls
69 lines (69 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
pattern_list:
- rule_expression: ${
and(
contains(request_url_path(), "hello"),
eq(request_http_method(), "POST"),
eq(request_http_header("Content-Type"), "application/json")
)
}
response:
body: Hello, complex rule!
headers:
Content-Type: text/plain; charset=utf-8
status_code: ${200}
- rule_expression: ${regex_match(request_url_path(), "^/myarray$")}
response:
body: "${[\"Hello\", \" world!\"]}"
headers:
Content-Type: text/plain; charset=utf-8
status_code: ${200}
- rule_expression: ${
and(
regex_match(request_url_path(), "^/mypost$"),
eq(request_http_method(), "POST")
)
}
latency: 2000
response:
body: Hello, post!
headers:
Content-Type: text/plain; charset=utf-8
status_code: ${200}
- rule_expression: ${regex_match(request_url_path(), "^/mylink$")}
response: ${link(var("some_link"))}
- rule_expression: ${regex_match(request_url_path(), "^/myfile$")}
response:
body: ${file("./main.go")}
headers:
Content-Type: ${var("default_content_type")}
Content-Language: ${
if(contains(request_http_header("Accept-Language"), "en"))
"en"
else
"it"
}
Cache-Control: ${request_http_header("Cache-Control")}
status_code: ${200}
- rule_expression: ${regex_match(request_url_path(), "^/myredirect$")}
response: ${redirect("http://localhost:8080/111", 301)}
- rule_expression: ${regex_match(request_url_path(), "^/[a-z]+$")}
response:
body: Hello, string!
headers:
Content-Type: text/plain; charset=utf-8
status_code: ${200}
- rule_expression: ${regex_match(request_url_path(), "^/[0-9]+$")}
response:
body: Hello, number!
headers:
Content-Type: text/plain; charset=utf-8
X-Test: some additional header
status_code: ${404}
- rule_expression: ${true}
response:
body: Hello, default body!
status_code: ${200}
vars:
some_link: http://localhost:8080/aaa
default_content_type: text/plain; charset=utf-8