Skip to content

Commit

Permalink
test variables mutated body
Browse files Browse the repository at this point in the history
  • Loading branch information
benzolium committed May 26, 2024
1 parent b52dec2 commit 3dc62ad
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
21 changes: 21 additions & 0 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,26 @@ func TestParseMultipartVariables(t *testing.T) {
},
res.fileMap,
)
assert.Equal(
t,
map[string]any{
"node1": map[string]any{
"node11": map[string]any{
"leaf111": nil,
"leaf112": "someThing",
"node113": map[string]any{"leaf1131": nil},
},
"leaf12": 42,
"leaf13": nil,
},
"node2": map[string]any{
"leaf21": false,
"node21": map[string]any{
"leaf211": nil,
},
},
},
res.m,
)
})
}
2 changes: 1 addition & 1 deletion gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (g *Gateway) Router(cfg *Config) http.Handler {
gatewayHandler.AddTransport(transport.Options{})
gatewayHandler.AddTransport(transport.GET{})
gatewayHandler.AddTransport(transport.POST{})
gatewayHandler.AddTransport(transport.MultipartForm{
gatewayHandler.AddTransport(transport.MultipartForm{
MaxUploadSize: cfg.MaxFileUploadSize,
})
if !cfg.DisableIntrospection {
Expand Down
4 changes: 2 additions & 2 deletions instrumentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ func (e *event) addFields(fields EventFields) {

func (e *event) finish() {
e.writeLock.Do(func() {
log.WithFields(log.Fields{
log.WithFields(log.Fields{
"timestamp": e.timestamp.Format(time.RFC3339Nano),
"duration": time.Since(e.timestamp).String(),
}).Info(e.name)
// log fields with "debug" by default, because we do not want to log the whole body in case of file upload
// log fields with "debug" by default, because we do not want to log the whole body in case of file upload
log.WithFields(log.Fields(e.fields)).Debug(e.name)
})
}
Expand Down

0 comments on commit 3dc62ad

Please sign in to comment.