MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / GetRequestBody

Function GetRequestBody

common/gin.go:15–27  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

13const KeyRequestBody = "key_request_body"
14
15func GetRequestBody(c *gin.Context) ([]byte, error) {
16 requestBody, _ := c.Get(KeyRequestBody)
17 if requestBody != nil {
18 return requestBody.([]byte), nil
19 }
20 requestBody, err := io.ReadAll(c.Request.Body)
21 if err != nil {
22 return nil, err
23 }
24 _ = c.Request.Body.Close()
25 c.Set(KeyRequestBody, requestBody)
26 return requestBody.([]byte), nil
27}
28
29func UnmarshalBodyReusable(c *gin.Context, v any) error {
30 requestBody, err := GetRequestBody(c)

Callers 5

relayRequestFunction · 0.92
wssRequestFunction · 0.92
claudeRequestFunction · 0.92
RelayTaskFunction · 0.92
UnmarshalBodyReusableFunction · 0.85

Calls 1

GetMethod · 0.80

Tested by

no test coverage detected