Skip to content

Instantly share code, notes, and snippets.

@dwburke
Last active July 23, 2018 00:28
Show Gist options
  • Save dwburke/3c42cf1767d69dfd8ef4ffd4befd8c8f to your computer and use it in GitHub Desktop.
Save dwburke/3c42cf1767d69dfd8ef4ffd4befd8c8f to your computer and use it in GitHub Desktop.
import "github.com/gin-gonic/gin"
func AllGinParams(c *gin.Context) gin.Params {
var params gin.Params
for _, p := range c.Params {
params = append(params, gin.Param{Key: p.Key, Value: p.Value})
}
req := c.Request
req.ParseForm()
for k, v := range req.PostForm {
if len(v) == 0 {
continue
}
params = append(params, gin.Param{Key: k, Value: v[0]})
}
return params
}
@dwburke
Copy link
Author

dwburke commented Jul 23, 2018

deliberately skips multipart form data atm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment