Unify error handling and HTTP statuses
Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
downloadschema "honoka-chan/internal/schema/download"
|
||||
"honoka-chan/internal/session"
|
||||
honokautils "honoka-chan/internal/utils"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@@ -42,7 +43,7 @@ func additional(ctx *gin.Context) {
|
||||
ss.Respond(downloadschema.AdditionalResp{
|
||||
ResponseData: pkgList,
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
StatusCode: http.StatusOK,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
downloadschema "honoka-chan/internal/schema/download"
|
||||
"honoka-chan/internal/session"
|
||||
honokautils "honoka-chan/internal/utils"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"xorm.io/builder"
|
||||
@@ -57,7 +58,7 @@ func batch(ctx *gin.Context) {
|
||||
ss.Respond(downloadschema.BatchResp{
|
||||
ResponseData: pkgList,
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
StatusCode: http.StatusOK,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"honoka-chan/internal/router"
|
||||
downloadschema "honoka-chan/internal/schema/download"
|
||||
"honoka-chan/internal/session"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@@ -16,7 +17,7 @@ func event(ctx *gin.Context) {
|
||||
ss.Respond(downloadschema.EventResp{
|
||||
ResponseData: []any{},
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
StatusCode: http.StatusOK,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
downloadschema "honoka-chan/internal/schema/download"
|
||||
"honoka-chan/internal/session"
|
||||
honokautils "honoka-chan/internal/utils"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -34,7 +35,7 @@ func getUrl(ctx *gin.Context) {
|
||||
UrlList: urlList,
|
||||
},
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
StatusCode: http.StatusOK,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ func update(ctx *gin.Context) {
|
||||
ss.Respond(downloadschema.UpdateResp{
|
||||
ResponseData: pkgList,
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
StatusCode: http.StatusOK,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user