server

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2023 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL