mirror of
https://github.com/ultrasn0w/huso.git
synced 2025-12-13 17:29:54 +01:00
Fix header check
This commit is contained in:
8
ober.go
8
ober.go
@@ -18,7 +18,7 @@ func RunWebserv() {
|
||||
r.GET("/api/season", Headers(Season))
|
||||
r.GET("/api/auth/{user}", Headers(AuthTest))
|
||||
r.GET("/api/anime/{id}", Headers(AnimeGet))
|
||||
r.GET("/api/animesearch/", Headers(AnimeSearchGet))
|
||||
r.GET("/api/animesearch", Headers(AnimeSearchGet))
|
||||
r.GET("/api/user/{user?}", Headers(UserGet))
|
||||
r.GET("/api/watch/{user?}", Headers(WatchGet))
|
||||
r.GET("/api/watchext/{user?}", Headers(WatchExtendedGet))
|
||||
@@ -240,7 +240,7 @@ func WatchExtendedGet(ctx *fasthttp.RequestCtx) {
|
||||
}
|
||||
|
||||
func Register(ctx *fasthttp.RequestCtx) {
|
||||
if string(ctx.Request.Header.ContentType()) != "application/json" {
|
||||
if !strings.Contains(string(ctx.Request.Header.ContentType()), "application/json") {
|
||||
ctx.SetStatusCode(fasthttp.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
@@ -304,7 +304,7 @@ func WatchPost(ctx *fasthttp.RequestCtx) {
|
||||
}
|
||||
|
||||
func UnRegister(ctx *fasthttp.RequestCtx) {
|
||||
if string(ctx.Request.Header.ContentType()) != "application/json" {
|
||||
if !strings.Contains(string(ctx.Request.Header.ContentType()), "application/json") {
|
||||
ctx.SetStatusCode(fasthttp.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
@@ -410,7 +410,7 @@ func watchGetLogic(ctx *fasthttp.RequestCtx) ([]AnimeUser, error) {
|
||||
|
||||
func processUpdateReq(ctx *fasthttp.RequestCtx, update bool) {
|
||||
auth := ctx.Request.Header.Peek("X-HUSO-AUTH")
|
||||
if ctx.UserValue("user") == nil || auth == nil || string(auth) == "" || string(ctx.Request.Header.ContentType()) != "application/json" {
|
||||
if ctx.UserValue("user") == nil || auth == nil || string(auth) == "" || !strings.Contains(string(ctx.Request.Header.ContentType()), "application/json") {
|
||||
ctx.SetStatusCode(fasthttp.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user