diff options
author | Valery Piashchynski <[email protected]> | 2021-06-03 16:59:10 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-06-03 16:59:10 +0300 |
commit | 063703e96e5f7cee59139e98d446d5577fb5c224 (patch) | |
tree | e669d08cbbafaa5d809bfb870e874d3de4683dad /plugins/http | |
parent | 62bbde7936109d18bf1f727974719804dad4c105 (diff) |
- Add internal_error_code option
- Update tests
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/http')
-rw-r--r-- | plugins/http/config/http.go | 7 | ||||
-rw-r--r-- | plugins/http/plugin.go | 2 |
2 files changed, 9 insertions, 0 deletions
diff --git a/plugins/http/config/http.go b/plugins/http/config/http.go index a1c2afa6..f06adc49 100644 --- a/plugins/http/config/http.go +++ b/plugins/http/config/http.go @@ -15,6 +15,9 @@ type HTTP struct { // Host and port to handle as http server. Address string + // InternalErrorCode used to override default 500 (InternalServerError) http code + InternalErrorCode uint64 `mapstructure:"internal_error_code"` + // SSLConfig defines https server options. SSLConfig *SSL `mapstructure:"ssl"` @@ -80,6 +83,10 @@ func (c *HTTP) InitDefaults() error { } } + if c.InternalErrorCode == 0 { + c.InternalErrorCode = 500 + } + if c.HTTP2Config == nil { c.HTTP2Config = &HTTP2{} } diff --git a/plugins/http/plugin.go b/plugins/http/plugin.go index 770ca8ca..1952679a 100644 --- a/plugins/http/plugin.go +++ b/plugins/http/plugin.go @@ -149,6 +149,7 @@ func (p *Plugin) serve(errCh chan error) { p.handler, err = handler.NewHandler( p.cfg.MaxRequestSize, + p.cfg.InternalErrorCode, *p.cfg.Uploads, p.cfg.Cidrs, p.pool, @@ -323,6 +324,7 @@ func (p *Plugin) Reset() error { p.handler, err = handler.NewHandler( p.cfg.MaxRequestSize, + p.cfg.InternalErrorCode, *p.cfg.Uploads, p.cfg.Cidrs, p.pool, |