It("makes the request and returns an error", func() { Expect(stopErr).To(HaveOccurred()) Expect(stopErr.Error()).To(MatchRegexp("use of closed network connection|Client.Timeout exceeded while awaiting headers")) Expect(fakeServer.ReceivedRequests()).To(HaveLen(1)) }) }) }) Describe("CancelTask", func() { const cellAddr = "cell.example.com" var cancelErr error var taskGuid = "some-task-guid" JustBeforeEach(func() { cancelErr = client.CancelTask(taskGuid) }) Context("when the request is successful", func() { BeforeEach(func() { fakeServer.AppendHandlers( ghttp.CombineHandlers( ghttp.VerifyRequest("POST", "/v1/tasks/some-task-guid/cancel"), ghttp.RespondWith(http.StatusAccepted, ""), ), ) }) It("makes the request and does not return an error", func() { Expect(cancelErr).NotTo(HaveOccurred()) Expect(fakeServer.ReceivedRequests()).To(HaveLen(1))