You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cors_test.go 642B

1234567891011121314151617181920212223
  1. // Copyright 2019 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package integration
  4. import (
  5. "net/http"
  6. "testing"
  7. "code.gitea.io/gitea/tests"
  8. "github.com/stretchr/testify/assert"
  9. )
  10. func TestCORSNotSet(t *testing.T) {
  11. defer tests.PrepareTestEnv(t)()
  12. req := NewRequestf(t, "GET", "/api/v1/version")
  13. session := loginUser(t, "user2")
  14. resp := session.MakeRequest(t, req, http.StatusOK)
  15. assert.Equal(t, resp.Code, http.StatusOK)
  16. corsHeader := resp.Header().Get("Access-Control-Allow-Origin")
  17. assert.Equal(t, corsHeader, "", "Access-Control-Allow-Origin: generated header should match") // header not set
  18. }