Skip to content

Commit 486e9bf

Browse files
authored
Merge pull request #11 from CodeShellDev/main
Update Dev
2 parents b98943e + a115f1f commit 486e9bf

File tree

3 files changed

+55
-8
lines changed

3 files changed

+55
-8
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Start Container
16+
2. Send Request
17+
3. [...]
18+
19+
**Expected behavior**
20+
A clear and concise description of what you expected to happen.
21+
22+
**Additional context**
23+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

internals/proxy/proxy.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ type AuthType string
2121

2222
const (
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

2929
func 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

Comments
 (0)