Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [Bug] InputArray returns a wrong value when requesting by form #378

Closed
2 of 3 tasks
hwbrzzl opened this issue Mar 20, 2024 · 2 comments
Closed
2 of 3 tasks

🐛 [Bug] InputArray returns a wrong value when requesting by form #378

hwbrzzl opened this issue Mar 20, 2024 · 2 comments

Comments

@hwbrzzl
Copy link
Contributor

hwbrzzl commented Mar 20, 2024

Before feedback (在反馈之前)

  • I've searched the existing Issues, Discussions and Google (我已经搜索了现有的 Issues, Discussions 和 Google)
  • The problem can be stably reproduced (这个问题可以被稳定复现)
  • The problem is generated after upgrading (问题是在升级之后产生的)

Operating System (操作系统)

Linux

Golang Version (Go 版本)

1.21.x

Goravel Version (Goravel 版本)

1.13.7

Describe The Problem (描述问题)

optionAnswer := ctx.Request().InputArray("bank_option[]")
optionAnswer2 := ctx.Request().Input("bank_option[]")
return ctx.Response().Json(http.StatusOK, http.Json{
  "option_answer":  optionAnswer,
  "option_answer2": optionAnswer2,
})

{
    // error
    "option_answer": [
        "option",
        "1,option",
        "2,option",
        "3"
    ],
    // unexpected
    "option_answer2": "option 1,option 2,option 3"
}

Reproduction Code (复现代码或截图)

curl --location 'http://localhost:3000/test' \
--form 'bank_option[]="option 1"' \
--form 'bank_option[]="option 2"' \
--form 'bank_option[]="option 3"' \
Copy link

Hi @hwbrzzl 👋

We think your feedback is very valuable! If you are interested, please submit a PR, please include test cases, documentation, etc., and ensure that the CI is passed, thank you and look forward to your contribution!
我们认为您的反馈非常有价值!如果有兴趣欢迎提交 PR,请包含相应的测试用例、文档等,并确保 CI 通过,感谢和期待您的贡献!

@hwbrzzl
Copy link
Contributor Author

hwbrzzl commented Apr 23, 2024

Fixed in goravel/gin v1.1.7 and goravel/fiber v1.1.14

@hwbrzzl hwbrzzl closed this as completed Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant