forked from NYANDEV/forgejo
Swagger info corrections (#9441)
* use numbers and not http.Status___ enum
* fix test
* add many missing swagger responses
* code format
* Deletion Sould return 204 ...
* error handling improvements
* if special error type ... then add it to swagger too
* one smal nit
* invalidTopicsError is []string
* valid swagger specification 2.0
- if you add responses swagger can tell you if you do it right 👍
* use ctx.InternalServerError
* Revert "use numbers and not http.Status___ enum"
This reverts commit b1ff386e2418ed6a7f183e756b13277d701278ef.
* use http.Status* enum everywhere
This commit is contained in:
parent
050a8af424
commit
2848c5eb8f
52 changed files with 1262 additions and 648 deletions
|
@ -5,6 +5,8 @@
|
|||
package repo
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
api "code.gitea.io/gitea/modules/structs"
|
||||
|
@ -88,7 +90,7 @@ func getGitRefs(ctx *context.APIContext, filter string) ([]*git.Reference, strin
|
|||
func getGitRefsInternal(ctx *context.APIContext, filter string) {
|
||||
refs, lastMethodName, err := getGitRefs(ctx, filter)
|
||||
if err != nil {
|
||||
ctx.Error(500, lastMethodName, err)
|
||||
ctx.Error(http.StatusInternalServerError, lastMethodName, err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -111,8 +113,8 @@ func getGitRefsInternal(ctx *context.APIContext, filter string) {
|
|||
}
|
||||
// If single reference is found and it matches filter exactly return it as object
|
||||
if len(apiRefs) == 1 && apiRefs[0].Ref == filter {
|
||||
ctx.JSON(200, &apiRefs[0])
|
||||
ctx.JSON(http.StatusOK, &apiRefs[0])
|
||||
return
|
||||
}
|
||||
ctx.JSON(200, &apiRefs)
|
||||
ctx.JSON(http.StatusOK, &apiRefs)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue