diff options
-rw-r--r-- | go.mod | 2 | ||||
-rw-r--r-- | service/headers/service_test.go | 33 |
2 files changed, 34 insertions, 1 deletions
@@ -6,7 +6,7 @@ require ( github.com/NYTimes/gziphandler v1.1.1 github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect github.com/buger/goterm v0.0.0-20181115115552-c206103e1f37 - github.com/cenkalti/backoff/v4 v4.0.0 // indirect + github.com/cenkalti/backoff/v4 v4.0.0 github.com/dustin/go-humanize v1.0.0 github.com/go-ole/go-ole v1.2.4 // indirect github.com/json-iterator/go v1.1.9 diff --git a/service/headers/service_test.go b/service/headers/service_test.go index e8d143d8..3ccea21b 100644 --- a/service/headers/service_test.go +++ b/service/headers/service_test.go @@ -110,6 +110,39 @@ func Test_ResponseHeaders(t *testing.T) { bkoff.MaxElapsedTime = time.Second * 15 err := backoff.Retry(func() error { + logger, _ := test.NewNullLogger() + logger.SetLevel(logrus.DebugLevel) + + c := service.NewContainer(logger) + c.Register(rrhttp.ID, &rrhttp.Service{}) + c.Register(ID, &Service{}) + + assert.NoError(t, c.Init(&testCfg{ + headers: `{"response":{"output": "output-header"},"request":{"input": "custom-header"}}`, + httpCfg: `{ + "enable": true, + "address": ":6079", + "maxRequestSize": 1024, + "workers":{ + "command": "php ../../tests/http/client.php header pipes", + "relay": "pipes", + "pool": { + "numWorkers": 1, + "allocateTimeout": 10000000, + "destroyTimeout": 10000000 + } + } + }`})) + + go func() { + err := c.Serve() + if err != nil { + t.Errorf("error during the Serve: error %v", err) + } + }() + time.Sleep(time.Millisecond * 100) + defer c.Stop() + req, err := http.NewRequest("GET", "http://localhost:6079?hello=value", nil) if err != nil { return err |