"code.cloudfoundry.org/lager" "code.cloudfoundry.org/lager/lagertest" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/urfave/negroni" ) var _ = Describe("AccessLog", func() { var ( handler negroni.Handler logger lager.Logger resp http.ResponseWriter proxyWriter utils.ProxyResponseWriter req *http.Request accessLogger *fakes.FakeAccessLogger extraHeadersToLog []string nextCalled bool ) nextHandler := http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { _, err := ioutil.ReadAll(req.Body) Expect(err).NotTo(HaveOccurred()) rw.WriteHeader(http.StatusTeapot) rw.Write([]byte("I'm a little teapot, short and stout.")) nextCalled = true
"code.cloudfoundry.org/gorouter/handlers" "code.cloudfoundry.org/gorouter/proxy/utils" "code.cloudfoundry.org/gorouter/test_util" "code.cloudfoundry.org/lager" "code.cloudfoundry.org/lager/lagertest" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/urfave/negroni" ) var _ = Describe("Healthcheck", func() { var ( handler negroni.Handler logger lager.Logger resp *httptest.ResponseRecorder proxyWriter utils.ProxyResponseWriter req *http.Request alr *schema.AccessLogRecord nextCalled bool heartbeatOK int32 ) nextHandler := http.HandlerFunc(func(http.ResponseWriter, *http.Request) { nextCalled = true }) TestHealthcheckOK := func() { It("closes the request", func() { handler.ServeHTTP(proxyWriter, req, nextHandler) Expect(req.Close).To(BeTrue()) Expect(nextCalled).To(BeFalse()) })