Expect(err).ToNot(HaveOccurred()) sseEvent := sse.Event{ Name: event.Action, Data: routeString, } headers := make(http.Header) headers.Set("Content-Type", "text/event-stream; charset=utf-8") command := buildCommand("events", flags, []string{}) server.SetHandler(0, ghttp.CombineHandlers( ghttp.VerifyRequest("GET", "/v1/events"), ghttp.RespondWith(http.StatusOK, sseEvent.Encode(), headers), ), ) session := routeRegistrar(command...) eventString, err := json.Marshal(event) Expect(err).ToNot(HaveOccurred()) eventString = append(eventString, '\n') Eventually(session, "2s").Should(Exit(0)) Expect(server.ReceivedRequests()).To(HaveLen(1)) Expect(string(session.Out.Contents())).To(ContainSubstring(string(eventString))) }) It("emits an error message on server termination", func() {