@@ -172,31 +172,31 @@ func TestServer_AllowedHosts(t *testing.T) {
172
172
hostHeader : "anything.com" ,
173
173
expectedStatusCode : http .StatusOK ,
174
174
},
175
- {
176
- name : "ipv6 literal allowed - no port" ,
177
- allowedHosts : []string {"2001:db8::1" },
178
- hostHeader : "[2001:db8::1]" ,
179
- expectedStatusCode : http .StatusOK ,
180
- },
181
- {
182
- name : "ipv6 literal allowed - with port" ,
183
- allowedHosts : []string {"2001:db8::1" },
184
- hostHeader : "[2001:db8::1]:1234" ,
185
- expectedStatusCode : http .StatusOK ,
186
- },
187
- {
188
- name : "ipv6 bracketed configured allowed - with port" ,
189
- allowedHosts : []string {"[2001:db8::1]" },
190
- hostHeader : "[2001:db8::1]:80" ,
191
- expectedStatusCode : http .StatusOK ,
192
- },
193
- {
194
- name : "ipv6 literal invalid host rejected" ,
195
- allowedHosts : []string {"2001:db8::1" },
196
- hostHeader : "[2001:db8::2]" ,
197
- expectedStatusCode : http .StatusBadRequest ,
198
- expectedErrorMsg : "Invalid host header. Allowed hosts: 2001:db8::1" ,
199
- },
175
+ {
176
+ name : "ipv6 literal allowed - no port" ,
177
+ allowedHosts : []string {"2001:db8::1" },
178
+ hostHeader : "[2001:db8::1]" ,
179
+ expectedStatusCode : http .StatusOK ,
180
+ },
181
+ {
182
+ name : "ipv6 literal allowed - with port" ,
183
+ allowedHosts : []string {"2001:db8::1" },
184
+ hostHeader : "[2001:db8::1]:1234" ,
185
+ expectedStatusCode : http .StatusOK ,
186
+ },
187
+ {
188
+ name : "ipv6 bracketed configured allowed - with port" ,
189
+ allowedHosts : []string {"[2001:db8::1]" },
190
+ hostHeader : "[2001:db8::1]:80" ,
191
+ expectedStatusCode : http .StatusOK ,
192
+ },
193
+ {
194
+ name : "ipv6 literal invalid host rejected" ,
195
+ allowedHosts : []string {"2001:db8::1" },
196
+ hostHeader : "[2001:db8::2]" ,
197
+ expectedStatusCode : http .StatusBadRequest ,
198
+ expectedErrorMsg : "Invalid host header. Allowed hosts: 2001:db8::1" ,
199
+ },
200
200
}
201
201
202
202
for _ , tc := range cases {
0 commit comments