diff options
author | Valery Piashchynski <[email protected]> | 2020-03-14 00:57:28 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-03-14 00:57:28 +0300 |
commit | 4ae5a7e7213798892d511a7a53ecd148e22ca7f6 (patch) | |
tree | c246bb679d5ba3f8bdb4857df074d9ea51e9deeb /service/gzip/service.go | |
parent | bb96eee28c4a171ad663861e08fce73708ce09ad (diff) |
Fix panic in Serve
Add test for the bug
Uncomment test in container. It's working properly now
Diffstat (limited to 'service/gzip/service.go')
-rw-r--r-- | service/gzip/service.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/service/gzip/service.go b/service/gzip/service.go index bb6bcfcd..5ae3ffd5 100644 --- a/service/gzip/service.go +++ b/service/gzip/service.go @@ -1,6 +1,7 @@ package gzip import ( + "errors" "github.com/NYTimes/gziphandler" rrhttp "github.com/spiral/roadrunner/service/http" "net/http" @@ -8,12 +9,16 @@ import ( // ID contains default service name. const ID = "gzip" +var httpNotInitialized = errors.New("http service should be defined properly in config") type Service struct { cfg *Config } func (s *Service) Init(cfg *Config, r *rrhttp.Service) (bool, error) { + if r == nil { + return false, httpNotInitialized + } s.cfg = cfg if !s.cfg.Enable { |