MCPcopy Create free account
hub / github.com/LumaAI-API/Luma-API / GetRequestBody

Function GetRequestBody

common/utils.go:177–189  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

175const KeyRequestBody = "key_request_body"
176
177func GetRequestBody(c *gin.Context) ([]byte, error) {
178 requestBody, _ := c.Get(KeyRequestBody)
179 if requestBody != nil {
180 return requestBody.([]byte), nil
181 }
182 requestBody, err := io.ReadAll(c.Request.Body)
183 if err != nil {
184 return nil, err
185 }
186 _ = c.Request.Body.Close()
187 c.Set(KeyRequestBody, requestBody)
188 return requestBody.([]byte), nil
189}
190
191func GetRootDir() string {
192 _, filename, _, _ := runtime.Caller(0)

Callers 1

UnmarshalBodyReusableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected