Also allow headers with CORS (#339)

This commit is contained in:
David Zhao
2022-01-14 10:13:11 -08:00
committed by GitHub
parent cf830191e3
commit cd9c125414
3 changed files with 7 additions and 7 deletions
+3 -2
View File
@@ -316,10 +316,11 @@ func TestSingleNodeCORS(t *testing.T) {
s, finish := setupSingleNodeTest("TestSingleNodeCORS", testRoom)
defer finish()
req, err := http.NewRequest("GET", fmt.Sprintf("http://localhost:%d", s.HTTPPort()), nil)
req, err := http.NewRequest("POST", fmt.Sprintf("http://localhost:%d", s.HTTPPort()), nil)
require.NoError(t, err)
req.Header.Set("Authorization", "bearer xyz")
req.Header.Set("Origin", "testhost.com")
res, err := http.DefaultClient.Do(req)
require.NoError(t, err)
require.Equal(t, "*", res.Header.Get("Access-Control-Allow-Origin"))
require.Equal(t, "testhost.com", res.Header.Get("Access-Control-Allow-Origin"))
}