1
0
Fork 0
forked from forgejo/forgejo

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:
KN4CK3R 2022-03-23 05:54:07 +01:00 committed by GitHub
parent 395117d301
commit 3f280f89e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
76 changed files with 211 additions and 212 deletions

View file

@ -227,7 +227,7 @@ func doAPICreatePullRequest(ctx APITestContext, owner, repo, baseBranch, headBra
Title: fmt.Sprintf("create a pr from %s to %s", headBranch, baseBranch),
})
expected := 201
expected := http.StatusCreated
if ctx.ExpectedCode != 0 {
expected = ctx.ExpectedCode
}
@ -246,7 +246,7 @@ func doAPIGetPullRequest(ctx APITestContext, owner, repo string, index int64) fu
owner, repo, index, ctx.Token)
req := NewRequest(t, http.MethodGet, urlStr)
expected := 200
expected := http.StatusOK
if ctx.ExpectedCode != 0 {
expected = ctx.ExpectedCode
}
@ -287,7 +287,7 @@ func doAPIMergePullRequest(ctx APITestContext, owner, repo string, index int64)
expected := ctx.ExpectedCode
if expected == 0 {
expected = 200
expected = http.StatusOK
}
if !assert.EqualValues(t, expected, resp.Code,
@ -310,7 +310,7 @@ func doAPIManuallyMergePullRequest(ctx APITestContext, owner, repo, commitID str
ctx.Session.MakeRequest(t, req, ctx.ExpectedCode)
return
}
ctx.Session.MakeRequest(t, req, 200)
ctx.Session.MakeRequest(t, req, http.StatusOK)
}
}