-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TT-12865] URL matching prefixes/explicit, regex support (#6475)
### **User description** https://tyktech.atlassian.net/browse/TT-12865 --- ### **PR Type** Bug fix, Tests ___ ### **Description** - Enhanced URL path matching to handle both stripped and full URL paths, ensuring backward compatibility. - Improved error handling and logging for regex matching in `ProcessRequest`. - Updated test cases to reflect changes in URL path handling and added new tests for regex matching. - Improved regex pattern handling by supporting patterns starting with '^' in `GetPathRegexp`. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Bug fix</strong></td><td><table> <tr> <td> <details> <summary><strong>mw_granular_access.go</strong><dd><code>Enhance URL path matching for backward compatibility</code> </dd></summary> <hr> gateway/mw_granular_access.go <li>Introduced handling for both stripped and full URL paths.<br> <li> Added error handling for regex matching.<br> <li> Refactored logger initialization.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6475/files#diff-618f7d55751d572562a29506a13beba2da969436e974f8b51df7d9708c925436">+17/-8</a> </td> </tr> <tr> <td> <details> <summary><strong>mux.go</strong><dd><code>Improve regex pattern handling in path matching</code> </dd></summary> <hr> internal/httputil/mux.go <li>Added handling for patterns starting with '^'.<br> <li> Ensured backward compatibility with existing regex patterns.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6475/files#diff-3d9ee5f5e946d72e6f2ae662ff03ee5253bbdc15203d2e4f6e9f46c13011ebf8">+3/-0</a> </td> </tr> </table></td></tr><tr><td><strong>Tests</strong></td><td><table> <tr> <td> <details> <summary><strong>mw_granular_access_test.go</strong><dd><code>Update tests for enhanced URL path matching</code> </dd></summary> <hr> gateway/mw_granular_access_test.go <li>Updated test cases to include regex matching for listen paths.<br> <li> Adjusted paths in test cases to reflect new listen path.<br> <li> Added new test cases for regex matching.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6475/files#diff-8e0d7cfef26688edd7d08334d955039dab5deb3caf860d29eff6d09894eaba20">+46/-27</a> </td> </tr> <tr> <td> <details> <summary><strong>mux_test.go</strong><dd><code>Add test for regex pattern handling improvement</code> </dd></summary> <hr> internal/httputil/mux_test.go - Added test case for regex pattern starting with '^'. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6475/files#diff-8f7ce1891e221d7adb9e68f2e951f33edfbde2128187abb6e837ac01952d7888">+1/-0</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions --------- Co-authored-by: Tit Petric <[email protected]>
- Loading branch information
Showing
16 changed files
with
1,237 additions
and
310 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.