feat: [#728] add http.Info and http.Name methods#1125
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces two new methods (Info() and Name()) on the HTTP request context and migrates route metadata from the route contract to the new http.Info type across the codebase.
- Replaced
route.Infowithhttp.Infoin contracts, mocks, command code, and tests - Added
Name()andInfo()methods (and correspondingInfostruct) toContextRequestand updated its mocks - Refactored
RouteListCommandto use the newhttp.Infotype and standalone helper functions
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| route/console/route_list_command_test.go | Updated imports, switched expected type to []http.Info, and renamed test function |
| route/console/route_list_command.go | Refactored to use http.Info, replaced receiver methods with standalone helpers, updated display |
| mocks/route/Route.go | Changed GetRoutes and Info mock signatures to return http.Info |
| mocks/http/ContextRequest.go | Added mocks for new Info() and Name() methods on ContextRequest |
| contracts/route/route.go | Updated interface methods to return contractshttp.Info and removed local Info struct |
| contracts/http/request.go | Added Name() and Info() to ContextRequest and defined new Info struct |
| contracts/http/method.go | Reordered constants and added new HTTP method types (ANY, RESOURCE, STATIC, etc.) |
Comments suppressed due to low confidence (3)
route/console/route_list_command.go:151
- [nitpick] The function name
formateNameHandlerappears to have a typo; consider renaming it toformatNameHandlerfor clarity and consistency.
func formateNameHandler(name, handler string) string {
route/console/route_list_command_test.go:16
- [nitpick] Go test functions conventionally use camel-case names without underscores; consider renaming this back to
TestRouteListCommand.
func Test_RouteListCommand(t *testing.T) {
contracts/http/request.go:22
- The newly added
Name()andInfo()methods onContextRequestlack unit tests; consider adding tests to verify their expected behavior.
Name() string
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1125 +/- ##
=======================================
Coverage 66.82% 66.82%
=======================================
Files 214 214
Lines 14104 14104
=======================================
Hits 9425 9425
Misses 4303 4303
Partials 376 376 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📑 Description
Closes goravel/goravel#728
Add two new methods:
✅ Checks