From 85562b7c0fd769520d8a2d041a6774fdf8030c53 Mon Sep 17 00:00:00 2001 From: Daniel Ortiz Date: Thu, 11 Jul 2024 22:15:14 +0000 Subject: [PATCH] Check that only our default is the response status code. Signed-off-by: Daniel Ortiz --- gin/cors_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gin/cors_test.go b/gin/cors_test.go index 45250a9..0937f0c 100644 --- a/gin/cors_test.go +++ b/gin/cors_test.go @@ -41,8 +41,8 @@ func TestNew(t *testing.T) { req.Header.Add("Access-Control-Request-Method", "GET") req.Header.Add("Access-Control-Request-Headers", "origin") e.ServeHTTP(res, req) - if res.Code != 200 && res.Code != 204 { - t.Errorf("Invalid status code: %d should be 200 or 204", res.Code) + if res.Code != 200 { + t.Errorf("Invalid status code: %d should be 200", res.Code) } assertHeaders(t, res.Header(), map[string]string{ @@ -75,8 +75,8 @@ func TestAllowOriginWildcard(t *testing.T) { req.Header.Add("Access-Control-Request-Method", "GET") req.Header.Add("Access-Control-Request-Headers", "origin") e.ServeHTTP(res, req) - if res.Code != 200 && res.Code != 204 { - t.Errorf("Invalid status code: %d should be 200 or 204", res.Code) + if res.Code != 200 { + t.Errorf("Invalid status code: %d should be 200", res.Code) } assertHeaders(t, res.Header(), map[string]string{ @@ -107,8 +107,8 @@ func TestAllowOriginEmpty(t *testing.T) { req.Header.Add("Access-Control-Request-Method", "GET") req.Header.Add("Access-Control-Request-Headers", "origin") e.ServeHTTP(res, req) - if res.Code != 200 && res.Code != 204 { - t.Errorf("Invalid status code: %d should be 200 or 204", res.Code) + if res.Code != 200 { + t.Errorf("Invalid status code: %d should be 200", res.Code) } assertHeaders(t, res.Header(), map[string]string{