diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..bfcb184 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,23 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Start Container +2. Send Request +3. [...] + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..11fc491 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/internals/proxy/proxy.go b/internals/proxy/proxy.go index 8158e20..f77abf8 100644 --- a/internals/proxy/proxy.go +++ b/internals/proxy/proxy.go @@ -21,9 +21,9 @@ type AuthType string const ( Bearer AuthType = "Bearer" - Basic AuthType = "Basic" - Query AuthType = "Query" - None AuthType = "None" + Basic AuthType = "Basic" + Query AuthType = "Query" + None AuthType = "None" ) func parseTypedQuery(values []string) interface{} { @@ -96,8 +96,8 @@ func templateJSON(data map[string]interface{}, variables map[string]interface{}) matches := re.FindAllStringSubmatch(str, -1) if len(matches) > 1 { - for i, tmplStr := range(matches) { - + for i, tmplStr := range matches { + tmplKey := matches[i][1] variable, err := json.Marshal(variables[tmplKey]) @@ -234,7 +234,11 @@ func TemplatingMiddleware(next http.Handler, VARIABLES map[string]interface{}) h modifiedBodyData = templateJSON(modifiedBodyData, VARIABLES) if req.URL.RawQuery != "" { - query, _ := renderTemplate("query", req.URL.RawQuery, VARIABLES) + decodedQuery, _ := url.QueryUnescape(req.URL.RawQuery) + + log.Debug("Decoded Query: ", decodedQuery) + + query, _ := renderTemplate("query", decodedQuery, VARIABLES) modifiedQuery := req.URL.Query() @@ -242,7 +246,7 @@ func TemplatingMiddleware(next http.Handler, VARIABLES map[string]interface{}) h for key, value := range queryData { keyWithoutPrefix, found := strings.CutPrefix(key, "@") - + if found { modifiedBodyData[keyWithoutPrefix] = parseTypedQuery(value) @@ -290,4 +294,4 @@ func Create(targetUrl string) *httputil.ReverseProxy { proxy := httputil.NewSingleHostReverseProxy(url) return proxy -} \ No newline at end of file +}