MCPcopy
hub / github.com/caddyserver/caddy / TestMapAsJSON

Function TestMapAsJSON

caddytest/integration/map_test.go:68–151  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

66}
67
68func TestMapAsJSON(t *testing.T) {
69 // arrange
70 tester := caddytest.NewTester(t)
71 tester.InitServer(`
72 {
73 "admin": {
74 "listen": "localhost:2999"
75 },
76 "apps": {
77 "pki": {
78 "certificate_authorities" : {
79 "local" : {
80 "install_trust": false
81 }
82 }
83 },
84 "http": {
85 "http_port": 9080,
86 "https_port": 9443,
87 "servers": {
88 "srv0": {
89 "listen": [
90 ":9080"
91 ],
92 "routes": [
93 {
94 "handle": [
95 {
96 "handler": "subroute",
97 "routes": [
98 {
99 "handle": [
100 {
101 "handler": "map",
102 "source": "{http.request.method}",
103 "destinations": ["{dest-name}"],
104 "defaults": ["unknown"],
105 "mappings": [
106 {
107 "input": "GET",
108 "outputs": ["get-called"]
109 },
110 {
111 "input": "POST",
112 "outputs": ["post-called"]
113 }
114 ]
115 }
116 ]
117 },
118 {
119 "handle": [
120 {
121 "body": "hello from localhost {dest-name}",
122 "handler": "static_response",
123 "status_code": 200
124 }
125 ],

Callers

nothing calls this directly

Calls 4

InitServerMethod · 0.95
AssertGetResponseMethod · 0.95
NewTesterFunction · 0.92

Tested by

no test coverage detected