eventstreamtesting

package module
v0.0.0-...-9fc2571 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package eventstreamtesting implements helper utilities for event stream protocol testing.

Index

Constants

This section is empty.

Variables

View Source
var EventExceptionTypeHeader = eventstream.Header{
	Name:  eventstreamapi.MessageTypeHeader,
	Value: eventstream.StringValue(eventstreamapi.ExceptionMessageType),
}

EventExceptionTypeHeader is an event exception type header for specifying an event is an exception type.

View Source
var EventMessageTypeHeader = eventstream.Header{
	Name:  eventstreamapi.MessageTypeHeader,
	Value: eventstream.StringValue(eventstreamapi.EventMessageType),
}

EventMessageTypeHeader is an event message type header for specifying an event is an message type.

Functions

func SetupEventStream

func SetupEventStream(
	t *testing.T, handler http.Handler,
) (
	cfg aws.Config, cleanupFn func(), err error,
)

SetupEventStream configures an HTTPS event stream testing server.

Types

type ServeEventStream

type ServeEventStream struct {
	T             *testing.T
	BiDirectional bool

	StaticResponse *StaticResponse

	Events       []eventstream.Message
	ClientEvents []eventstream.Message

	ForceCloseAfter time.Duration
	// contains filtered or unexported fields
}

ServeEventStream provides serving EventStream messages from a HTTP server to the client. The events are sent sequentially to the client without delay.

func (ServeEventStream) ServeHTTP

func (s ServeEventStream) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves an HTTP client request

type StaticResponse

type StaticResponse struct {
	StatusCode int
	Body       []byte
}

StaticResponse provides a way to define an HTTP event stream server that provides a fixed static response.

Jump to

Keyboard shortcuts

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