本站源代码
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

23 lines
671B

  1. // Copyright 2019 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package integrations
  5. import (
  6. "net/http"
  7. "testing"
  8. "github.com/stretchr/testify/assert"
  9. )
  10. func TestCORSNotSet(t *testing.T) {
  11. 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. }
上海开阖软件有限公司 沪ICP备12045867号-1