1
0
mirror of https://github.com/labstack/echo.git synced 2025-11-27 22:38:25 +02:00

use echo.GetPath for rewrite in proxy (#1548)

Co-authored-by: Arun Gopalpuri <arun@gopalpuri.com>
This commit is contained in:
Arun Gopalpuri
2020-04-08 08:19:22 -07:00
committed by GitHub
parent 6e7c7cea03
commit 2207c37bf8
3 changed files with 9 additions and 4 deletions

View File

@@ -104,6 +104,10 @@ func TestProxy(t *testing.T) {
e.ServeHTTP(rec, req)
assert.Equal(t, "/user/jack/order/1", req.URL.Path)
assert.Equal(t, http.StatusOK, rec.Code)
req.URL.Path = "/users/jill/orders/T%2FcO4lW%2Ft%2FVp%2F"
e.ServeHTTP(rec, req)
assert.Equal(t, "/user/jill/order/T%2FcO4lW%2Ft%2FVp%2F", req.URL.Path)
assert.Equal(t, http.StatusOK, rec.Code)
// ProxyTarget is set in context
contextObserver := func(next echo.HandlerFunc) echo.HandlerFunc {