-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
bugfix proxy and rewrite, updated test with actual call settings #1630
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1630 +/- ##
==========================================
+ Coverage 85.28% 85.40% +0.11%
==========================================
Files 28 28
Lines 2216 2206 -10
==========================================
- Hits 1890 1884 -6
+ Misses 212 208 -4
Partials 114 114
Continue to review full report at Codecov.
|
I could not check on it yet. Will look into next week. |
@lammel - I updated the issue description and fixed code accordingly. Let me know if you have any questions. |
@lammel - resolved merge conflicts. |
can someone review this PR? @lammel ? |
I'm running out of time currently. Will try to look into it in the next days. |
PR looks fine. No overall performance regression seen (no dedicated benchmark exists yet). |
@lammel - Thanks! Did you forget to click merge? :) |
Could be... worked better on the second attempt ;-) |
Issue: Proxy and Rewrite Middleware don't set URL appropriately in tests and this causes different behavior when running tests vs when proxy and rewrite middleware are used in real server mode.
We should use url Parse method instead.
Check how path, raw path is set when using URL.Parse in this playground example. This is how url path and raw path is set when running echo server and invoking API endpoints.
After updating tests, was able to find a bug in proxy and rewrite and was able to fix it (and made sure it passes in real scenario calls as well).
Also, refactored some common code that's shared between proxy with rewrite rules and rewrite middleware rules. This also fixed one other bug e.g. the regex rules for rewrite is different from proxy regex rules when they should be same (rewrite regex rules works as expected).
After refactoring and using common function the below test works in proxy and rewrite (in current master code, proxy test for below scenario would fail):