MCPcopy
hub / github.com/livekit/livekit / TestSingleNodeCORS

Function TestSingleNodeCORS

test/singlenode_test.go:603–618  ·  view source on GitHub ↗

Ensure that CORS headers are returned

(t *testing.T)

Source from the content-addressed store, hash-verified

601
602// Ensure that CORS headers are returned
603func TestSingleNodeCORS(t *testing.T) {
604 if testing.Short() {
605 t.SkipNow()
606 return
607 }
608 s, finish := setupSingleNodeTest("TestSingleNodeCORS")
609 defer finish()
610
611 req, err := http.NewRequest("POST", fmt.Sprintf("http://localhost:%d", s.HTTPPort()), nil)
612 require.NoError(t, err)
613 req.Header.Set("Authorization", "bearer xyz")
614 req.Header.Set("Origin", "testhost.com")
615 res, err := http.DefaultClient.Do(req)
616 require.NoError(t, err)
617 require.Equal(t, "testhost.com", res.Header.Get("Access-Control-Allow-Origin"))
618}
619
620func TestSingleNodeDoubleSlash(t *testing.T) {
621 if testing.Short() {

Callers

nothing calls this directly

Calls 3

setupSingleNodeTestFunction · 0.85
HTTPPortMethod · 0.80
GetMethod · 0.45

Tested by

no test coverage detected