Skip to content

Commit cf14ef7

Browse files
authored
fix: VARIABLES mutating (#130)
1 parent a02b72e commit cf14ef7

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

internals/proxy/middlewares/mapping.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ func mappingHandler(next http.Handler) http.Handler {
6464
err := body.Write(req)
6565

6666
if err != nil {
67+
log.Error("Could not write to Request Body: ", err.Error())
6768
http.Error(w, "Internal Error", http.StatusInternalServerError)
6869
return
6970
}

internals/proxy/middlewares/message.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ func messageHandler(next http.Handler) http.Handler {
6363
err := body.Write(req)
6464

6565
if err != nil {
66+
log.Error("Could not write to Request Body: ", err.Error())
6667
http.Error(w, "Internal Error", http.StatusInternalServerError)
6768
return
6869
}

internals/proxy/middlewares/template.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ func templateHandler(next http.Handler) http.Handler {
7575
err := body.Write(req)
7676

7777
if err != nil {
78+
log.Error("Could not write to Request Body: ", err.Error())
7879
http.Error(w, "Internal Error", http.StatusInternalServerError)
7980
return
8081
}
@@ -182,7 +183,9 @@ func TemplateBody(body map[string]any, headers map[string][]string, VARIABLES ma
182183
// Prefix Header Data with header_key_
183184
prefixedHeaders := prefixData("header_key_", request.ParseHeaders(headers))
184185

185-
variables := VARIABLES
186+
variables := map[string]any{}
187+
188+
maps.Copy(variables, VARIABLES)
186189

187190
maps.Copy(variables, prefixedBody)
188191
maps.Copy(variables, prefixedHeaders)

0 commit comments

Comments
 (0)