| 1492 | } |
| 1493 | |
| 1494 | func TestAccessControlAllowOriginHeader(t *testing.T) { |
| 1495 | t.Parallel() |
| 1496 | |
| 1497 | baseURL := startHTTP(t, apiCfg) |
| 1498 | cli := &http.Client{ |
| 1499 | Timeout: time.Second, |
| 1500 | } |
| 1501 | |
| 1502 | req, _ := http.NewRequest("GET", baseURL+"/rest/system/status", nil) |
| 1503 | req.Header.Set("X-API-Key", testAPIKey) |
| 1504 | resp, err := cli.Do(req) |
| 1505 | if err != nil { |
| 1506 | t.Fatal(err) |
| 1507 | } |
| 1508 | |
| 1509 | resp.Body.Close() |
| 1510 | if resp.StatusCode != http.StatusOK { |
| 1511 | t.Fatal("GET on /rest/system/status should succeed, not", resp.Status) |
| 1512 | } |
| 1513 | if resp.Header.Get("Access-Control-Allow-Origin") != "*" { |
| 1514 | t.Fatal("GET on /rest/system/status should return a 'Access-Control-Allow-Origin: *' header") |
| 1515 | } |
| 1516 | } |
| 1517 | |
| 1518 | func TestOptionsRequest(t *testing.T) { |
| 1519 | t.Parallel() |