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 = boshdispatcher.NewHTTPSDispatcher(parsedURL, logger)
	return
}
Beispiel #2
0
	. "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.LevelNone)
		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)
		}