From 1ae2aac83c390f5ecd8725932ef08add166bd5ec Mon Sep 17 00:00:00 2001 From: Jeevanandam M Date: Sun, 24 Sep 2023 10:45:23 -0700 Subject: [PATCH] Revert "fix: correct url path params processing order #519 (#705)" (#708) This reverts commit 0424ad12ac597fc5b01c557d96b83942853dba19. --- middleware.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/middleware.go b/middleware.go index 9fd29508..abf909cf 100644 --- a/middleware.go +++ b/middleware.go @@ -27,25 +27,25 @@ const debugRequestLogKey = "__restyDebugRequestLog" func parseRequestURL(c *Client, r *Request) error { // GitHub #103 Path Params - if len(c.PathParams) > 0 { - for p, v := range c.PathParams { + if len(r.PathParams) > 0 { + for p, v := range r.PathParams { r.URL = strings.Replace(r.URL, "{"+p+"}", url.PathEscape(v), -1) } } - if len(r.PathParams) > 0 { - for p, v := range r.PathParams { + if len(c.PathParams) > 0 { + for p, v := range c.PathParams { r.URL = strings.Replace(r.URL, "{"+p+"}", url.PathEscape(v), -1) } } // GitHub #663 Raw Path Params - if len(c.RawPathParams) > 0 { - for p, v := range c.RawPathParams { + if len(r.RawPathParams) > 0 { + for p, v := range r.RawPathParams { r.URL = strings.Replace(r.URL, "{"+p+"}", v, -1) } } - if len(r.RawPathParams) > 0 { - for p, v := range r.RawPathParams { + if len(c.RawPathParams) > 0 { + for p, v := range c.RawPathParams { r.URL = strings.Replace(r.URL, "{"+p+"}", v, -1) } }