🐛 [Bug] InputArray returns a wrong value when requesting by form
hwbrzzl opened this issue · comments
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"' \
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 通过,感谢和期待您的贡献!
Fixed in goravel/gin v1.1.7 and goravel/fiber v1.1.14