diff options
author | Valery Piashchynski <[email protected]> | 2021-03-16 17:05:28 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-03-16 17:05:28 +0300 |
commit | e5508fa1ae3a068913b54fa7aaef2a47bca91f76 (patch) | |
tree | 386fd7c985c464170afe6523dc5e57d6a85a1616 | |
parent | eec190334e03012e9dfc3ba83c106d8b3974b238 (diff) |
🐛 fix issue with strange messages in the http body when max request
reached
Signed-off-by: Valery Piashchynski <[email protected]>
-rw-r--r-- | .github/workflows/linux.yml | 2 | ||||
-rwxr-xr-x | Makefile | 8 | ||||
-rw-r--r-- | plugins/http/handler.go | 5 | ||||
-rw-r--r-- | tests/plugins/status/plugin_test.go | 2 |
4 files changed, 8 insertions, 9 deletions
diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 00057e38..c5fde431 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -74,7 +74,7 @@ jobs: go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/informer.txt -covermode=atomic ./tests/plugins/informer go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/reload.txt -covermode=atomic ./tests/plugins/reload go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/server.txt -covermode=atomic ./tests/plugins/server - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/checker.txt -covermode=atomic ./tests/plugins/checker + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/status.txt -covermode=atomic ./tests/plugins/status go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/config.txt -covermode=atomic ./tests/plugins/config go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/gzip.txt -covermode=atomic ./tests/plugins/gzip go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/headers.txt -covermode=atomic ./tests/plugins/headers @@ -36,7 +36,7 @@ test_coverage: go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/informer.out -covermode=atomic ./tests/plugins/informer go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/reload.out -covermode=atomic ./tests/plugins/reload go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/server.out -covermode=atomic ./tests/plugins/server - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/checker.out -covermode=atomic ./tests/plugins/checker + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/status.out -covermode=atomic ./tests/plugins/status go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/config.out -covermode=atomic ./tests/plugins/config go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/gzip.out -covermode=atomic ./tests/plugins/gzip go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/headers.out -covermode=atomic ./tests/plugins/headers @@ -68,7 +68,7 @@ test: ## Run application tests go test -v -race -tags=debug ./tests/plugins/informer go test -v -race -tags=debug ./tests/plugins/reload go test -v -race -tags=debug ./tests/plugins/server - go test -v -race -tags=debug ./tests/plugins/checker + go test -v -race -tags=debug ./tests/plugins/status go test -v -race -tags=debug ./tests/plugins/config go test -v -race -tags=debug ./tests/plugins/gzip go test -v -race -tags=debug ./tests/plugins/headers @@ -98,7 +98,7 @@ test_1.14: ## Run application tests go1.14.14 test -v -race -tags=debug ./tests/plugins/informer go1.14.14 test -v -race -tags=debug ./tests/plugins/reload go1.14.14 test -v -race -tags=debug ./tests/plugins/server - go1.14.14 test -v -race -tags=debug ./tests/plugins/checker + go1.14.14 test -v -race -tags=debug ./tests/plugins/status go1.14.14 test -v -race -tags=debug ./tests/plugins/config go1.14.14 test -v -race -tags=debug ./tests/plugins/gzip go1.14.14 test -v -race -tags=debug ./tests/plugins/headers @@ -128,7 +128,7 @@ test_1.16: ## Run application tests go1.16rc1 test -v -race -tags=debug ./tests/plugins/informer go1.16rc1 test -v -race -tags=debug ./tests/plugins/reload go1.16rc1 test -v -race -tags=debug ./tests/plugins/server - go1.16rc1 test -v -race -tags=debug ./tests/plugins/checker + go1.16rc1 test -v -race -tags=debug ./tests/plugins/status go1.16rc1 test -v -race -tags=debug ./tests/plugins/config go1.16rc1 test -v -race -tags=debug ./tests/plugins/gzip go1.16rc1 test -v -race -tags=debug ./tests/plugins/headers diff --git a/plugins/http/handler.go b/plugins/http/handler.go index 11d9b827..b7c6f1fa 100644 --- a/plugins/http/handler.go +++ b/plugins/http/handler.go @@ -106,11 +106,10 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } if size > int64(h.maxRequestSize) { + h.sendEvent(ErrorEvent{Request: r, Error: errors.E(op, errors.Str("request body max size is exceeded")), start: start, elapsed: time.Since(start)}) http.Error(w, errors.E(op, errors.Str("request body max size is exceeded")).Error(), 500) + return } - - h.sendEvent(ErrorEvent{Request: r, Error: errors.E(op, errors.Str("request body max size is exceeded")), start: start, elapsed: time.Since(start)}) - return } } diff --git a/tests/plugins/status/plugin_test.go b/tests/plugins/status/plugin_test.go index 3330cb20..a7322353 100644 --- a/tests/plugins/status/plugin_test.go +++ b/tests/plugins/status/plugin_test.go @@ -114,7 +114,7 @@ func TestStatusRPC(t *testing.T) { assert.NoError(t, err) cfg := &config.Viper{ - Path: "configs/.rr-checker-init.yaml", + Path: "configs/.rr-status-init.yaml", Prefix: "rr", } |