(t *testing.T)
| 132 | } |
| 133 | |
| 134 | func TestInvalidPrefix(t *testing.T) { |
| 135 | type testCase struct { |
| 136 | config, expectedError string |
| 137 | } |
| 138 | |
| 139 | failureCases := []testCase{ |
| 140 | { |
| 141 | config: `wss://localhost`, |
| 142 | expectedError: `the scheme wss:// is only supported in browsers; use https:// instead`, |
| 143 | }, |
| 144 | { |
| 145 | config: `ws://localhost`, |
| 146 | expectedError: `the scheme ws:// is only supported in browsers; use http:// instead`, |
| 147 | }, |
| 148 | { |
| 149 | config: `someInvalidPrefix://localhost`, |
| 150 | expectedError: "unsupported URL scheme someinvalidprefix://", |
| 151 | }, |
| 152 | { |
| 153 | config: `h2c://localhost`, |
| 154 | expectedError: `unsupported URL scheme h2c://`, |
| 155 | }, |
| 156 | { |
| 157 | config: `localhost, wss://localhost`, |
| 158 | expectedError: `the scheme wss:// is only supported in browsers; use https:// instead`, |
| 159 | }, |
| 160 | { |
| 161 | config: `localhost { |
| 162 | reverse_proxy ws://localhost" |
| 163 | }`, |
| 164 | expectedError: `the scheme ws:// is only supported in browsers; use http:// instead`, |
| 165 | }, |
| 166 | { |
| 167 | config: `localhost { |
| 168 | reverse_proxy someInvalidPrefix://localhost" |
| 169 | }`, |
| 170 | expectedError: `unsupported URL scheme someinvalidprefix://`, |
| 171 | }, |
| 172 | } |
| 173 | |
| 174 | for _, failureCase := range failureCases { |
| 175 | caddytest.AssertLoadError(t, failureCase.config, "caddyfile", failureCase.expectedError) |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | func TestValidPrefix(t *testing.T) { |
| 180 | type testCase struct { |
nothing calls this directly
no test coverage detected