-
Notifications
You must be signed in to change notification settings - Fork 1
Refactor http-injector to support custom injection parser for parsing http parameters #80
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
Merged
Conversation
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
- Add support for injecting various types of parameters in Gin handlers - Implement parsers for different data types including struct, slice, map, and basic types - Add name-based and type-based parameter injection - Implement query parameter binding for both single and multiple values - Add support for binding HTTP request, response writer, and context - Implement unit tests for delay bind injector and parsers
- Add support for parsing all query parameters as a string - Implement parsing for struct and map types using BindQuery - Add handling for slice types in query parameters - Improve error handling and add more test cases for query parsing
… and types - Add test cases for NameParser interface for cookies, headers, and params - Implement tests for TypeParser interface for various types (context, response, request, URL) - Add load test to verify parser initialization - Update httpRequestTypeParser and urlTypeParser to return correct types
- Rename and reorganize files for better structure - Update import paths to use `internal` package - Modify `bindExecutor` to use `NameParser` instead of `TypeParser` - Remove `http_injector.go` and related code - Add `load.go` for dynamic injector loading
- Add comprehensive tests for bindExecutor initialization and functionality - Update delay_bind_injector to remove unnecessary UUID generation - Add Flag embedding to MockNameParser and MockTypeParser for better mocking
…andling - Update link function to handle struct pointer types - Add error handling and logging for field setter errors - Improve test coverage for delay bind injector
- Remove internal Context struct, use *gin.Context directly- Consolidate context type parsers into a single ginContextTypeParser - Update proxy and injector to work with the new context type - Add RequestBody and Query structs for improved request handling
…ndling - Change database name from demo1 to demo in default.properties - Update user ID type from int64 to uint64 across multiple files - Refactor user controller to use Token struct instead of raw user ID - Add tokenParser to handle token extraction in routes- Update router initialization to include tokenParser
- Add overview section to introduce HttpInjector and its components - Detail core components: HttpInjector, DelayBindInjector, and BindExecutor- Explain supported types and labels for injection - Include examples for each injection type - Describe implementation principles and core code - Add advanced usage examples, including custom parsers - Clarify performance optimizations and error handling - Improve document structure and readability
Refactor and enhance the HTTP injection documentation to improve readability and correctness. This includes fixing typos, updating examples, and ensuring consistency between the English and Chinese versions. The changes also clarify the usage of custom parameter parsers and improve the overall structure of the documentation.
- Update github.com/gin-gonic/gin from v1.10.0 to v1.10.1 - Remove unused imports - Update go.mod and go.sum files - Make minor code adjustment in controller.go
…nding - Add mock implementation for DelayBindInjector interface - Enhance query binding logic to support wildcard and improve nil handling - Update proxy to include time statistics and improve argument processing - Add unit tests for proxy functionality
- Add new test for injector BuildLoad function - Enhance proxy test to include request body handling - Update proxy test to use JSON content type and body - Improve proxy test to verify request body deserialization
Codecov ReportAll modified and coverable lines are covered by tests ✅
🚀 New features to boost your workflow:
|
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.
No description provided.