refactor(context): use http.StatusContinue constant instead of magic number 100#4542
refactor(context): use http.StatusContinue constant instead of magic number 100#4542mehrdadbn9 wants to merge 3 commits intogin-gonic:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4542 +/- ##
==========================================
+ Coverage 99.21% 99.27% +0.06%
==========================================
Files 42 46 +4
Lines 3182 3038 -144
==========================================
- Hits 3157 3016 -141
+ Misses 17 15 -2
+ Partials 8 7 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This pull request refactors the bodyAllowedForStatus function in context.go to replace the magic number 100 with the http.StatusContinue constant for better code clarity. Additionally, the PR includes extensive test coverage improvements across multiple files.
Changes:
- Replaced magic number 100 with http.StatusContinue constant in bodyAllowedForStatus function
- Added comprehensive test coverage for multiple functions across the codebase
- Added new test file for codec/json package
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| context.go | Replaced magic number 100 with http.StatusContinue constant and added clarifying comment |
| context_test.go | Added tests for http.StatusContinue, GetRawData with nil body, SameSiteDefaultMode cookie behavior, multipart form errors, and binding edge cases |
| utils_test.go | Added test for successful XML marshaling of H type |
| logger_test.go | Added test case for 400ms latency color |
| gin_test.go | Added tests for error handling in ServeHTTP |
| codec/json/json_test.go | New test file covering JSON codec API functions |
| binding/binding_test.go | Added test for Plain binding BindBody method |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
10e6086 to
96185ac
Compare
…number 100 Replace magic number 100 with http.StatusContinue constant for better code clarity and maintainability in bodyAllowedForStatus function. Also fix typo in logger_test.go: colorForLantency -> colorForLatency Fixes gin-gonic#4489
46fc8ad to
65c72a8
Compare
- Add TestContextGetRawDataNilBody to cover nil body error case - Add SameSiteDefaultMode test case in SetCookieData - Add 400ms latency test case for LatencyColor - Add TestMarshalXMLforHSuccess for successful XML marshaling Coverage improved from 99.1% to 99.2%
54bfc38 to
7df2142
Compare
Replace magic number `100` with `http.StatusContinue` constant for better code clarity and maintainability in `bodyAllowedForStatus` function.
Fixes #4489