Skip to content

Commit 22013cd

Browse files
committed
update Content-Length to match req.Body length
1 parent fd49bcf commit 22013cd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internals/proxy/proxy.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"net/url"
1010
"os"
1111
"slices"
12+
"strconv"
1213
"strings"
1314
"text/template"
1415

@@ -148,9 +149,12 @@ func TemplatingMiddleware(next http.Handler, VARIABLES map[string]string) http.H
148149
modifiedBodyBytes := []byte(modifiedBody)
149150

150151
req.Body = io.NopCloser(bytes.NewReader(modifiedBodyBytes))
152+
req.ContentLength = int64(len(modifiedBody))
153+
req.Header.Set("Content-Length", strconv.Itoa(len(modifiedBody)))
151154
}
152155

153156
reqPath := req.URL.Path
157+
reqPath, _ = url.PathUnescape(reqPath)
154158

155159
modifiedReqPath, _ := renderTemplate("path", reqPath, VARIABLES)
156160

0 commit comments

Comments
 (0)