(t *testing.T)
| 66 | } |
| 67 | |
| 68 | func 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 | ], |
nothing calls this directly
no test coverage detected