File tree Expand file tree Collapse file tree 3 files changed +10
-16
lines changed
internals/proxy/middlewares Expand file tree Collapse file tree 3 files changed +10
-16
lines changed Original file line number Diff line number Diff line change @@ -44,8 +44,6 @@ func (data AuthMiddleware) Use() http.Handler {
4444 return
4545 }
4646
47- log .Info ("Request:" , req .Method , req .URL .Path )
48-
4947 authHeader := req .Header .Get ("Authorization" )
5048
5149 authQuery := req .URL .Query ().Get ("@authorization" )
Original file line number Diff line number Diff line change @@ -74,18 +74,16 @@ func (data BodyMiddleware) Use() http.Handler {
7474 http .Error (w , "Internal Error" , http .StatusInternalServerError )
7575 return
7676 }
77- }
78-
79- modifiedBody := string (bodyBytes )
8077
81- req . Body = io . NopCloser ( bytes . NewReader ( bodyBytes ) )
78+ modifiedBody := string ( bodyBytes )
8279
83- req .ContentLength = int64 (len (modifiedBody ))
84- req .Header .Set ("Content-Length" , strconv .Itoa (len (modifiedBody )))
85- } else {
86- req .Body = io .NopCloser (bytes .NewReader (bodyBytes ))
80+ req .ContentLength = int64 (len (modifiedBody ))
81+ req .Header .Set ("Content-Length" , strconv .Itoa (len (modifiedBody )))
82+ }
8783 }
8884
85+ req .Body = io .NopCloser (bytes .NewReader (bodyBytes ))
86+
8987 next .ServeHTTP (w , req )
9088 })
9189}
Original file line number Diff line number Diff line change @@ -127,26 +127,24 @@ func (data TemplateMiddleware) Use() http.Handler {
127127 log .Debug ("Applied Query Templating: " , templatedQuery )
128128 }
129129
130- modifiedBodyBytes , err : = json .Marshal (modifiedBodyData )
130+ bodyBytes , err = json .Marshal (modifiedBodyData )
131131
132132 if err != nil {
133133 log .Error ("Could not encode Body: " , err .Error ())
134134 http .Error (w , "Internal Error" , http .StatusInternalServerError )
135135 return
136136 }
137137
138- modifiedBody := string (modifiedBodyBytes )
138+ modifiedBody := string (bodyBytes )
139139
140140 log .Debug ("Applied Body Templating: " , modifiedBody )
141141
142- req .Body = io .NopCloser (bytes .NewReader (modifiedBodyBytes ))
143-
144142 req .ContentLength = int64 (len (modifiedBody ))
145143 req .Header .Set ("Content-Length" , strconv .Itoa (len (modifiedBody )))
146- } else {
147- req .Body = io .NopCloser (bytes .NewReader (bodyBytes ))
148144 }
149145
146+ req .Body = io .NopCloser (bytes .NewReader (bodyBytes ))
147+
150148 reqPath := req .URL .Path
151149 reqPath , _ = url .PathUnescape (reqPath )
152150
You can’t perform that action at this time.
0 commit comments