MCPcopy Index your code
hub / github.com/53AI/53AIHub / RequestDecoder

Function RequestDecoder

api/middleware/request_decoder.go:17–36  ·  view source on GitHub ↗

RequestDecoder 请求体ID解码中间件

()

Source from the content-addressed store, hash-verified

15
16// RequestDecoder 请求体ID解码中间件
17func RequestDecoder() gin.HandlerFunc {
18 return func(c *gin.Context) {
19 // 只处理JSON请求体
20 // if c.GetHeader("Content-Type") != "application/json" {
21 // c.Next()
22 // return
23 // }
24
25 // 只处理POST、PUT、PATCH请求
26 method := c.Request.Method
27 switch method {
28 case "POST", "PUT", "PATCH", "GET", "DELETE":
29 unpdatePath(c)
30 updateQuery(c)
31 updateBody(c)
32 }
33
34 c.Next()
35 }
36}
37
38func updateBody(c *gin.Context) {
39 // 读取请求体

Callers

nothing calls this directly

Calls 3

unpdatePathFunction · 0.85
updateQueryFunction · 0.85
updateBodyFunction · 0.85

Tested by

no test coverage detected