func NewHttpsHandler(parsedURL *url.URL, logger boshlog.Logger, fs boshsys.FileSystem, dirProvider boshdir.DirectoriesProvider) (handler HttpsHandler) { handler.parsedURL = parsedURL handler.logger = logger handler.fs = fs handler.dirProvider = dirProvider handler.dispatcher = boshhttps.NewHttpsDispatcher(parsedURL, logger) return }
. "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "net/http" "net/url" "time" ) var _ = Describe("HttpsDispatcher", func() { var ( dispatcher boshdispatcher.HttpsDispatcher ) BeforeEach(func() { serverUrl, _ := url.Parse("https://127.0.0.1:7788") logger := boshlog.NewLogger(boshlog.LEVEL_NONE) dispatcher = boshdispatcher.NewHttpsDispatcher(serverUrl, logger) go dispatcher.Start() time.Sleep(1 * time.Second) }) AfterEach(func() { dispatcher.Stop() time.Sleep(1 * time.Second) }) It("calls the handler function for the route", func() { var hasBeenCalled = false handler := func(w http.ResponseWriter, r *http.Request) { hasBeenCalled = true w.WriteHeader(201) }