diff options
author | 6543 <6543@obermui.de> | 2022-07-21 21:18:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-21 21:18:41 +0200 |
commit | 0a97480934fc2082c9cff18a5b66cedc12575919 (patch) | |
tree | 8f756dd6e2abaefd9909e3e438b22b8ecae292d6 /integrations | |
parent | 7690de56f7bdcc5065af2c9478e8572d318a84f3 (diff) | |
download | gitea-0a97480934fc2082c9cff18a5b66cedc12575919.tar.gz gitea-0a97480934fc2082c9cff18a5b66cedc12575919.zip |
Add "X-Gitea-Object-Type" header for GET `/raw/` & `/media/` API (#20438)
Diffstat (limited to 'integrations')
-rw-r--r-- | integrations/api_repo_raw_test.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/integrations/api_repo_raw_test.go b/integrations/api_repo_raw_test.go index 2a77d1ba63..258b409bef 100644 --- a/integrations/api_repo_raw_test.go +++ b/integrations/api_repo_raw_test.go @@ -10,6 +10,8 @@ import ( "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" + + "github.com/stretchr/testify/assert" ) func TestAPIReposRaw(t *testing.T) { @@ -25,9 +27,11 @@ func TestAPIReposRaw(t *testing.T) { "65f1bf27bc3bf70f64657658635e66094edbcb4d", // Commit } { req := NewRequestf(t, "GET", "/api/v1/repos/%s/repo1/raw/%s/README.md?token="+token, user.Name, ref) - session.MakeRequest(t, req, http.StatusOK) + resp := session.MakeRequest(t, req, http.StatusOK) + assert.EqualValues(t, "file", resp.Header().Get("x-gitea-object-type")) } // Test default branch req := NewRequestf(t, "GET", "/api/v1/repos/%s/repo1/raw/README.md?token="+token, user.Name) - session.MakeRequest(t, req, http.StatusOK) + resp := session.MakeRequest(t, req, http.StatusOK) + assert.EqualValues(t, "file", resp.Header().Get("x-gitea-object-type")) } |