Possible to inject body into Gins context

Is it possible to update the request body of a gin.Context? Im trying to reuse a controller function but i need to add to the body before calling it.

		authorized.GET("/stars", func(ctx *gin.Context) {
			fmt.Println("Stars")
			queryReq := QueryRequest{
				Table: "stars",
			}
			data, _ := json.Marshal(queryReq)
			ctx.Set("request_body", data)
			controller.Query(ctx)
		})

func (c *controller) Query(ctx *gin.Context)

Rest of the code i dont think matters. I tried doing ctx.Set but isnt working

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.