mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-07-09 22:55:51 +08:00
Update HTTP status codes to modern codes (#18063)
* 2xx/3xx/4xx/5xx -> http.Status... * http.StatusFound -> http.StatusTemporaryRedirect * http.StatusMovedPermanently -> http.StatusPermanentRedirect
This commit is contained in:
cmd
integrations
admin_user_test.goapi_branch_test.goapi_helper_for_declarative_test.goapi_pull_test.goapi_repo_languages_test.goattachment_test.goauth_ldap_test.gochange_default_branch_test.gocreate_no_session_test.godelete_user_test.goeditor_test.gogit_smart_http_test.gogit_test.gointegration_test.goissue_test.golinks_test.gomirror_push_test.gononascii_branches_test.gooauth_test.goprivateactivity_test.gopull_create_test.gopull_merge_test.gopull_status_test.gorelease_test.gorename_branch_test.gorepo_branch_test.gorepo_fork_test.gorepo_generate_test.gorepo_migrate_test.gosetting_test.gosignout_test.gosignup_test.gouser_avatar_test.gouser_test.goxss_test.go
modules
routers
api/v1
common
install
web
services
auth
lfs
migrations
templates/swagger
@ -37,7 +37,7 @@ func testAPIGetBranchProtection(t *testing.T, branchName string, expectedHTTPSta
|
||||
req := NewRequestf(t, "GET", "/api/v1/repos/user2/repo1/branch_protections/%s?token=%s", branchName, token)
|
||||
resp := session.MakeRequest(t, req, expectedHTTPStatus)
|
||||
|
||||
if resp.Code == 200 {
|
||||
if resp.Code == http.StatusOK {
|
||||
var branchProtection api.BranchProtection
|
||||
DecodeJSON(t, resp, &branchProtection)
|
||||
assert.EqualValues(t, branchName, branchProtection.BranchName)
|
||||
@ -52,7 +52,7 @@ func testAPICreateBranchProtection(t *testing.T, branchName string, expectedHTTP
|
||||
})
|
||||
resp := session.MakeRequest(t, req, expectedHTTPStatus)
|
||||
|
||||
if resp.Code == 201 {
|
||||
if resp.Code == http.StatusCreated {
|
||||
var branchProtection api.BranchProtection
|
||||
DecodeJSON(t, resp, &branchProtection)
|
||||
assert.EqualValues(t, branchName, branchProtection.BranchName)
|
||||
@ -65,7 +65,7 @@ func testAPIEditBranchProtection(t *testing.T, branchName string, body *api.Bran
|
||||
req := NewRequestWithJSON(t, "PATCH", "/api/v1/repos/user2/repo1/branch_protections/"+branchName+"?token="+token, body)
|
||||
resp := session.MakeRequest(t, req, expectedHTTPStatus)
|
||||
|
||||
if resp.Code == 200 {
|
||||
if resp.Code == http.StatusOK {
|
||||
var branchProtection api.BranchProtection
|
||||
DecodeJSON(t, resp, &branchProtection)
|
||||
assert.EqualValues(t, branchName, branchProtection.BranchName)
|
||||
|
Reference in New Issue
Block a user