@@ -21,9 +21,9 @@ type AuthType string
2121
2222const (
2323 Bearer AuthType = "Bearer"
24- Basic AuthType = "Basic"
25- Query AuthType = "Query"
26- None AuthType = "None"
24+ Basic AuthType = "Basic"
25+ Query AuthType = "Query"
26+ None AuthType = "None"
2727)
2828
2929func parseTypedQuery (values []string ) interface {} {
@@ -96,8 +96,8 @@ func templateJSON(data map[string]interface{}, variables map[string]interface{})
9696 matches := re .FindAllStringSubmatch (str , - 1 )
9797
9898 if len (matches ) > 1 {
99- for i , tmplStr := range ( matches ) {
100-
99+ for i , tmplStr := range matches {
100+
101101 tmplKey := matches [i ][1 ]
102102
103103 variable , err := json .Marshal (variables [tmplKey ])
@@ -234,15 +234,19 @@ func TemplatingMiddleware(next http.Handler, VARIABLES map[string]interface{}) h
234234 modifiedBodyData = templateJSON (modifiedBodyData , VARIABLES )
235235
236236 if req .URL .RawQuery != "" {
237- query , _ := renderTemplate ("query" , req .URL .RawQuery , VARIABLES )
237+ decodedQuery , _ := url .QueryUnescape (req .URL .RawQuery )
238+
239+ log .Debug ("Decoded Query: " , decodedQuery )
240+
241+ query , _ := renderTemplate ("query" , decodedQuery , VARIABLES )
238242
239243 modifiedQuery := req .URL .Query ()
240244
241245 queryData , _ := url .ParseQuery (query )
242246
243247 for key , value := range queryData {
244248 keyWithoutPrefix , found := strings .CutPrefix (key , "@" )
245-
249+
246250 if found {
247251 modifiedBodyData [keyWithoutPrefix ] = parseTypedQuery (value )
248252
@@ -290,4 +294,4 @@ func Create(targetUrl string) *httputil.ReverseProxy {
290294 proxy := httputil .NewSingleHostReverseProxy (url )
291295
292296 return proxy
293- }
297+ }
0 commit comments