Small fix

use the same code path in the unit test for setting the maxBodySize as
the main program.
This commit is contained in:
Felix Niederwanger 2024-04-01 17:15:45 +02:00
parent 3ad2e79deb
commit bab3cbc95e
Signed by: phoenix
GPG key ID: 6E77A590E3F6D71C
2 changed files with 2 additions and 1 deletions

View file

@ -225,6 +225,7 @@ func RegisterHandlers(cf Config, mux *http.ServeMux) error {
if hook.Concurrency < 1 {
hook.Concurrency = 1
}
// allow hooks to have individual maxBodySize arguments.
if cf.Settings.MaxBodySize > 0 && hook.maxBodySize == 0 {
hook.maxBodySize = cf.Settings.MaxBodySize
}

View file

@ -288,7 +288,7 @@ func TestHeaderAndBody(t *testing.T) {
cf.Settings.BindAddress = "127.0.0.1:2088"
cf.Settings.MaxBodySize = int64(len(bodyIncluded))
cf.Hooks = make([]Hook, 0)
cf.Hooks = append(cf.Hooks, Hook{Name: "hook", Command: fmt.Sprintf("tee %s", tempFile.Name()), Route: "/header_and_body", maxBodySize: cf.Settings.MaxBodySize})
cf.Hooks = append(cf.Hooks, Hook{Name: "hook", Command: fmt.Sprintf("tee %s", tempFile.Name()), Route: "/header_and_body"})
listener, err := CreateListener(cf)
if err != nil {