Documentation
¶
Index ¶
- type MockHandler
- func (h *MockHandler) Close()
- func (h *MockHandler) CloseActiveRequest(block bool)
- func (h *MockHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)
- func (h *MockHandler) WriteEvent(event *base.MessageEvent)
- func (h *MockHandler) WriteRetry(delayInMillis int, getDecoder func() *decoder.Decoder)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockHandler ¶
type MockHandler struct { // URL of the HTTP test server URL string // Content Type that will be served by the test server. ContentType string // MaxRequestsToProcess before closing the stream. MaxRequestsToProcess int // Server requires basic authorization if username is set BasicAuth struct { Username string Password string } // Connected notifies when the connection has been accepted and is ready // to send events Connected chan struct{} // contains filtered or unexported fields }
MockHandler used to emulate an http server that follows the SSE spec
func NewMockHandler ¶
func NewMockHandler(t *testing.T) *MockHandler
func (*MockHandler) Close ¶
func (h *MockHandler) Close()
Close cancels both the active request being served and the underlying test HTTP server
func (*MockHandler) CloseActiveRequest ¶
func (h *MockHandler) CloseActiveRequest(block bool)
CloseActiveRequest cancels the current request being served
func (*MockHandler) ServeHTTP ¶
func (h *MockHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)
func (*MockHandler) WriteEvent ¶
func (h *MockHandler) WriteEvent(event *base.MessageEvent)
func (*MockHandler) WriteRetry ¶
func (h *MockHandler) WriteRetry(delayInMillis int, getDecoder func() *decoder.Decoder)
Click to show internal directories.
Click to hide internal directories.