-
-
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
♻️ Refactor: Rename the Method Names of FormData and FormDatas (#3251) #3255
Conversation
WalkthroughThe pull request introduces a comprehensive renaming of methods related to form data handling across multiple files in the Gofiber HTTP client. The changes focus on improving method naming conventions, making them more consistent and clear. The modifications span Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (5)
🔇 Additional comments (11)client/hooks_test.go (2)
The test case has been correctly updated to use
Both test cases have been updated to use the new method name Also applies to: 501-503 client/client.go (1)
The client/request.go (3)
Methods have been simplified by removing redundant "Data" suffix:
This change improves readability while maintaining functionality. Also applies to: 470-471
Methods have been renamed to clearly indicate they operate on maps:
The new names better describe their functionality and maintain consistency with the existing
FormData struct methods have been renamed to follow the same pattern:
The changes improve code clarity and maintain consistency across the codebase. docs/client/request.md (2)
The documentation for the renamed form data methods is clear, consistent, and properly reflects the new method names while maintaining the same functionality:
The documentation for the FormData struct methods is clear and follows a consistent pattern:
client/request_test.go (3)Line range hint The test cases have been correctly updated to use the new method names while maintaining comprehensive test coverage for form data operations. Line range hint The tests and benchmarks for AllFormData have been correctly updated to use the new method names while maintaining proper test coverage and performance testing. Line range hint The test file changes look good. Let's verify that all occurrences of the old method names have been updated consistently across the codebase. ✅ Verification successfulBased on the search results, I can see that there are no occurrences of the old method names in the codebase, and the new method names are consistently used. The changes appear to be complete and consistent. All method renames have been properly implemented 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Check for any remaining occurrences of old method names
# Check for old method names
echo "Checking for old method names..."
rg -i "AddFormDatas|SetFormDatas|SetFormDatasWithStruct|DelFormDatas|AddData|SetData|AddDatas|SetDatas|SetDatasWithStruct|DelDatas"
# Check for new method names to confirm changes
echo "Verifying new method names..."
rg -i "AddFormDataWithMap|SetFormDataWithMap|SetFormDataWithStruct|DelFormData|Add|Set|AddWithMap|SetWithMap|SetWithStruct|DelData"
Length of output: 99445 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 (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3255 +/- ##
==========================================
- Coverage 82.72% 82.63% -0.10%
==========================================
Files 115 115
Lines 11365 11365
==========================================
- Hits 9402 9391 -11
- Misses 1557 1565 +8
- Partials 406 409 +3
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
Fixes #3251
Description
Preserved
AddFormData
andSetFormData
:I kept
AddFormData
andSetFormData
unchanged because "FormData" is an HTTP-specific term. Moreover, the term aligns with the existingformData
field, making it consistent.Renamed
*FormDatas
to*FormDataWithMap
:Since there is already a method called
*FormDatasWithStruct
, I renamed*FormDatas
to*FormDataWithMap
for better clarity and intuitiveness during usage. TheWithMap
andWithStruct
suffixes provide a clear indication that these methods can handle multiple key-value pairs.Renamed
AddData
andSetData
(inFormData
) toAdd
andSet
:The methods
AddData
andSetData
inFormData
were renamed toAdd
andSet
to align with the naming convention infasthttp.Args
, which also usesAdd
andSet
.func (r *Request) AddFormData
→ Not changedfunc (r *Request) AddFormDatas
→func (r *Request) AddFormDataWithMap
func (r *Request) SetFormData
→ Not changedfunc (r *Request) SetFormDatas
→func (r *Request) SetFormDataWithMap
func (r *Request) SetFormDatasWithStruct
→func (r *Request) SetFormDataWithStruct
(removes
)func (r *Request) DelFormDatas
→func (r *Request) DelFormData
(removes
)func (f *FormData) AddData
→func (f *FormData) Add
(keep consistent withfasthttp.Args
)func (f *FormData) SetData
→func (f *FormData) Set
(keep consistent withfasthttp.Args
)func (f *FormData) AddDatas
→func (f *FormData) AddWithMap
func (f *FormData) SetDatas
→func (f *FormData) SetWithMap
func (f *FormData) SetDatasWithStruct
→func (f *FormData) SetWithStruct
func (f *FormData) DelDatas
→func (f *FormData) DelData
(removes
)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.