Query and post form parameters

  1. POST /post?id=a&id=b&id=c&name=john&name=doe&name=kataras
  2. Content-Type: application/x-www-form-urlencoded
  1. func main() {
  2. app := iris.Default()
  3. app.Post("/post", func(ctx iris.Context) {
  4. ids := ctx.URLParamSlice("id")
  5. names, err := ctx.PostValues("name")
  6. if err != nil {
  7. ctx.StopWithError(iris.StatusBadRequest, err)
  8. return
  9. }
  10. ctx.Writef("ids: %v; names: %v", ids, names)
  11. })
  12. app.Listen(":8080")
  13. }
  1. ids: [a b c], names: [john doe kataras]