as: Add more useful APIs

Signed-off-by: Yuan Si <do4suki@gmail.com>
This commit is contained in:
2023-05-25 04:23:25 +08:00
parent 29ae1681c7
commit c18842ef95
13 changed files with 9334 additions and 114 deletions
+8
View File
@@ -3,6 +3,7 @@ package middleware
import (
"fmt"
"honoka-chan/database"
"io"
"net/http"
"net/url"
"strconv"
@@ -79,6 +80,13 @@ func Common(ctx *gin.Context) {
}
func CommonAs(ctx *gin.Context) {
body, err := io.ReadAll(ctx.Request.Body)
if err != nil {
panic(err)
}
defer ctx.Request.Body.Close()
ctx.Set("reqBody", string(body))
ep := strings.ReplaceAll(ctx.Request.URL.String(), "/ep3071", "")
ctx.Set("ep", ep)