@@ -172,31 +172,31 @@ func TestServer_AllowedHosts(t *testing.T) {
172172 hostHeader : "anything.com" ,
173173 expectedStatusCode : http .StatusOK ,
174174 },
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+ },
200200 }
201201
202202 for _ , tc := range cases {
0 commit comments