Skip to content

feat: [#334] Supports use ctx.Request().Bind after ctx.Request.Validate#1190

Merged
almas-x merged 1 commit intomasterfrom
almas/#334
Sep 9, 2025
Merged

feat: [#334] Supports use ctx.Request().Bind after ctx.Request.Validate#1190
almas-x merged 1 commit intomasterfrom
almas/#334

Conversation

@almas-x
Copy link
Contributor

@almas-x almas-x commented Sep 9, 2025

📑 Description

Closes goravel/goravel#334

✅ Checks

  • Added test cases for my code

Copilot AI review requested due to automatic review settings September 9, 2025 03:20
@almas-x almas-x requested a review from a team as a code owner September 9, 2025 03:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: true configuration to the global validation options

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codecov
Copy link

codecov bot commented Sep 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.29%. Comparing base (b41556f) to head (9713b06).
⚠️ Report is 1 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 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.

@almas-x
Copy link
Contributor Author

almas-x commented Sep 9, 2025

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

Copy link
Contributor

@hwbrzzl hwbrzzl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, we can add the test in goravel/example.

opt.StopOnError = false
opt.SkipOnEmpty = true
opt.FieldTag = "form"
opt.RestoreRequestBody = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know this new option. 👍

@almas-x almas-x merged commit e3df315 into master Sep 9, 2025
13 of 14 checks passed
@almas-x almas-x deleted the almas/#334 branch September 9, 2025 08:41
alfanzain pushed a commit to alfanzain/goravel-framework that referenced this pull request Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ [Feature] Supports use ctx.Request().Bind after ctx.Request.Validate

3 participants