Ensure that CORS headers are returned
(t *testing.T)
| 601 | |
| 602 | // Ensure that CORS headers are returned |
| 603 | func 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 | |
| 620 | func TestSingleNodeDoubleSlash(t *testing.T) { |
| 621 | if testing.Short() { |
nothing calls this directly
no test coverage detected