Context("as the Nth node", func() { var statusCode int var response interface{} var ranA bool var bData []byte BeforeEach(func() { ranA = false bData = nil statusCode = http.StatusOK server.AppendHandlers(ghttp.CombineHandlers( ghttp.VerifyRequest("GET", "/BeforeSuiteState"), ghttp.RespondWith(http.StatusOK, string((types.RemoteBeforeSuiteData{nil, types.RemoteBeforeSuiteStatePending}).ToJSON())), ), ghttp.CombineHandlers( ghttp.VerifyRequest("GET", "/BeforeSuiteState"), ghttp.RespondWith(http.StatusOK, string((types.RemoteBeforeSuiteData{nil, types.RemoteBeforeSuiteStatePending}).ToJSON())), ), ghttp.CombineHandlers( ghttp.VerifyRequest("GET", "/BeforeSuiteState"), ghttp.RespondWithJSONEncodedPtr(&statusCode, &response), )) node = newNode(func() []byte { ranA = true return nil }, func(data []byte) { bData = data })
unixSocketServer.HTTPTestServer = &httptest.Server{ Listener: unixSocketListener, Config: &http.Server{Handler: unixSocketServer}, } unixSocketServer.Start() client = http.Client{Transport: New(socket)} }) Context("when a simple GET request is sent", func() { BeforeEach(func() { unixSocketServer.AppendHandlers( ghttp.CombineHandlers( ghttp.VerifyRequest("GET", "/_ping"), ghttp.RespondWith(http.StatusOK, "true"), ), ) resp, err = client.Get("unix://" + socket + "/_ping") }) It("responds with correct status", func() { Expect(err).NotTo(HaveOccurred()) Expect(resp.StatusCode).To(Equal(http.StatusOK)) }) It("responds with correct body", func() { bytes, err := ioutil.ReadAll(resp.Body) Expect(err).NotTo(HaveOccurred())