Skip to content

Commit

Permalink
Revert "fix: correct url path params processing order #519 (#705)" (#708
Browse files Browse the repository at this point in the history
)

This reverts commit 0424ad1.
  • Loading branch information
jeevatkm committed Sep 24, 2023
1 parent e6602aa commit 1ae2aac
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions middleware.go
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 1ae2aac

Please sign in to comment.