feat: [#334] Supports use ctx.Request().Bind after ctx.Request.Validate#1190
feat: [#334] Supports use ctx.Request().Bind after ctx.Request.Validate#1190
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR enables request body reuse after validation by configuring the validation library to restore the request body. This addresses issue #334 where ctx.Request().Bind() could not be used after ctx.Request().Validate() because the request body was consumed during validation.
- Adds
RestoreRequestBody: trueconfiguration to the global validation options
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1190 +/- ##
=======================================
Coverage 68.29% 68.29%
=======================================
Files 233 233
Lines 15071 15072 +1
=======================================
+ Hits 10292 10293 +1
Misses 4399 4399
Partials 380 380 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.
| Benchmark suite | Current: 9713b06 | Previous: b41556f | Ratio |
|---|---|---|---|
Benchmark_Fatal |
4e-7 ns/op 0 B/op 0 allocs/op |
2e-7 ns/op 0 B/op 0 allocs/op |
2 |
Benchmark_Fatal - ns/op |
4e-7 ns/op |
2e-7 ns/op |
2 |
This comment was automatically generated by workflow using github-action-benchmark.
|
Should the unit tests for this change be added to the framework repository, or should they be included in the gin/fiber driver repositories instead? @hwbrzzl |
hwbrzzl
left a comment
There was a problem hiding this comment.
LGTM, we can add the test in goravel/example.
| opt.StopOnError = false | ||
| opt.SkipOnEmpty = true | ||
| opt.FieldTag = "form" | ||
| opt.RestoreRequestBody = true |
There was a problem hiding this comment.
Good to know this new option. 👍
📑 Description
Closes goravel/goravel#334
✅ Checks