-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
🐛 fix: Update binder in form_test #3336
Conversation
WalkthroughThe pull request updates the benchmark function in Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (3)
⏰ Context from checks skipped due to timeout of 90000ms (5)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
binder/form_test.go
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: unit (1.24.x, macos-13)
- GitHub Check: unit (1.24.x, macos-latest)
- GitHub Check: unit (1.24.x, windows-latest)
- GitHub Check: unit (1.23.x, windows-latest)
- GitHub Check: Compare
- GitHub Check: Analyse
- GitHub Check: repeated
🔇 Additional comments (2)
binder/form_test.go (2)
73-73
: Correct method for setting form data in the request body.The change from
req.URI().SetQueryString()
toreq.SetBodyString()
is appropriate because:
- Form data should be in the request body, not the URL query parameters
- This aligns with the "application/x-www-form-urlencoded" content type set on line 74
- It's consistent with how a real form submission would work
This change properly fixes the mismatch between the binding mechanism and the request data location.
57-87
:✅ Verification successful
Verify test accuracy with struct tag inconsistency.
While the binding mechanism has been corrected, the test may not be working as expected because of the struct tag mismatch. The
User
struct still usesquery:
tags while theFormBinding
expectsform:
tags. This could result in binding not working correctly or relying on unintended fallback behavior.To verify if the test is actually binding correctly, we can check for inconsistent behavior:
🏁 Script executed:
#!/bin/bash # Check if there's any code in the repo that handles the mismatch between # binding type (form) and struct tags (query) # Look for form binding implementation that might handle query tags rg -A 10 -B 10 "func.*FormBinding.*Bind" --type go # Look for any code that maps between query and form tags rg "query.*form|form.*query" --type goLength of output: 2797
Binding Test Verified: Supported Tags Are Correct
The review concern about a mismatch between struct tags and the binding mechanism is no longer applicable. The binder configuration in
binder/mapping.go
explicitly supports bothquery
andform
tags (as seen with the tags list:["header", "respHeader", "cookie", "query", "form", "uri"]
). This confirms that theUser
struct usingquery:"..."
tags in the test is handled correctly by the binding code. No further changes are required for this test.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3336 +/- ##
==========================================
+ Coverage 84.23% 84.30% +0.06%
==========================================
Files 116 116
Lines 11578 11578
==========================================
+ Hits 9753 9761 +8
+ Misses 1395 1389 -6
+ Partials 430 428 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM
Description
Fix error binder in form_test.
Fixes # (issue)
Changes introduced
List the new features or adjustments introduced in this pull request. Provide details on benchmarks, documentation updates, changelog entries, and if applicable, the migration guide.
Type of change
Please delete options that are not relevant.
Checklist
Before you submit your pull request, please make sure you meet these requirements:
/docs/
directory for Fiber's documentation.Commit formatting
Please use emojis in commit messages for an easy way to identify the purpose or intention of a commit. Check out the emoji cheatsheet here: CONTRIBUTING.md