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.
24 lines
713 B
24 lines
713 B
6 years ago
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||
|
// Use of this source code is governed by a MIT-style
|
||
|
// license that can be found in the LICENSE file.
|
||
|
|
||
2 years ago
|
package integration
|
||
6 years ago
|
|
||
|
import (
|
||
|
"net/http"
|
||
|
"testing"
|
||
|
|
||
2 years ago
|
"code.gitea.io/gitea/tests"
|
||
6 years ago
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
func TestCORSNotSet(t *testing.T) {
|
||
2 years ago
|
defer tests.PrepareTestEnv(t)()
|
||
6 years ago
|
req := NewRequestf(t, "GET", "/api/v1/version")
|
||
|
session := loginUser(t, "user2")
|
||
|
resp := session.MakeRequest(t, req, http.StatusOK)
|
||
|
assert.Equal(t, resp.Code, http.StatusOK)
|
||
|
corsHeader := resp.Header().Get("Access-Control-Allow-Origin")
|
||
|
assert.Equal(t, corsHeader, "", "Access-Control-Allow-Origin: generated header should match") // header not set
|
||
|
}
|